My issue
I am subtracting the intro length from ep2 to last ep and adding the duration . Still can’t figure out what’s wrong
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int s;
cin>>s;
int dur=0;
vector<int> intro(s);
for(int i=0 ; i<s ;i++){
cin>>intro[i];
}
for(int i=0 ;i<s ; i++){
int a;
cin>>a;
for(int j=0;j<a;j++){
int p;
cin>>p;
if(j==0){
dur+=p;
}
else{
dur+= p - intro[i];
}
}
}
cout<<dur<<endl;
}
return 0;
}
Learning course: Level up from 1* to 2*
Problem Link: CodeChef: Practical coding for everyone