aboutsummaryrefslogtreecommitdiff
path: root/codechef/collegLife2/main.cpp
blob: 231767fca21bf9685a72c7cabbbbb026929cdf7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<bits/stdc++.h>

using namespace std;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt;
	cin >> tt;
	while(tt--){
    int s, introLength, numberOfEposides, eposideLength;
    long long ans = 0;
    cin >> s;
    vector<int> seasons(s); // array containg the introLength of each season
    for(auto &x : seasons) {
      cin >> x;
    }
    for(int i = 0 ; i < s; i++) {
      cin >> numberOfEposides;
      for(int j = 0; j < numberOfEposides; j++) {
        int x;
        cin >> x;
        if(j == 0) {
          ans += x;
        }
        if(j > 0) {
          ans += x - seasons[i];
        }
      }
    }
    cout << ans << endl;
	}
}