# College Life 2 (WA)

`````` #include <iostream>
using namespace std;

int main() {
int t,s,ep;
cin>>t;
while(t--){
cin>>s;
int du=0;
int q[s];
for(int i=0;i<s;i++)
cin>>q[i];
for(int i=0;i<s;i++){
cin>>e;
int l,a=0;
for(int j=0;j<e;j++){
cin>>l;
a=a+l;
}
du=du+(a-((e-1)*q[i]));
}
cout<<du<<endl;
}
return 0;
}
``````

Here I am adding the total duration of all episodes per season and subtracting (e-1)*q[i], where e is the number of episodes and q[i] is the intro time per season .
I don’t know why I am getting a wrong answer.

1 Like

your du and a should both be long long.

1 Like

Ahhhh !!! It worked … Thank you soo much 1 Like

why ? there is no such thing >=10^9 in the question.

@amandikshit10 Well the max number of episodes over one test case was 10^5 ( given by this line :
Sum of all Ei in a single testcase is at most 10^5). The length of every every episode <= 10^5(let it be 10^5 for each episode in worst case). Therefore total time = 10^5 * 10^5 = 10^10, which is clearly more than the the capacity of int, which is roughly 2*10^9 (seems to still fail around on anything more than 10^9).
so even though the values in themselves are all less than 10^9, when you add them all up they can get larger.
i hope this helps 