diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-06-21 15:06:29 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-06-21 15:06:29 +0200 |
| commit | 42013225064413fdb31599d1b3304065c3964707 (patch) | |
| tree | 932de94c62961c5db86f623b82079fb13f2e8dcd /codechef/collegLife2/main.cpp | |
| parent | b1828ab2fe7eaedc3104e5c2b46eb08940299738 (diff) | |
| download | competitive-programming-42013225064413fdb31599d1b3304065c3964707.tar.xz competitive-programming-42013225064413fdb31599d1b3304065c3964707.zip | |
Solved collegeLife2 from codechef
Diffstat (limited to 'codechef/collegLife2/main.cpp')
| -rw-r--r-- | codechef/collegLife2/main.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/codechef/collegLife2/main.cpp b/codechef/collegLife2/main.cpp index 0e72523..231767f 100644 --- a/codechef/collegLife2/main.cpp +++ b/codechef/collegLife2/main.cpp @@ -8,9 +8,26 @@ int main () { int tt; cin >> tt; while(tt--){ - int s; - vector<int> q(s); - - + 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; } } |
