From 42013225064413fdb31599d1b3304065c3964707 Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Tue, 21 Jun 2022 15:06:29 +0200 Subject: Solved collegeLife2 from codechef --- codechef/collegLife2/main.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'codechef/collegLife2/main.cpp') 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 q(s); - - + int s, introLength, numberOfEposides, eposideLength; + long long ans = 0; + cin >> s; + vector 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; } } -- cgit v1.2.3