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 | Bin 0 -> 27320 bytes codechef/collegLife2/main.cpp | 25 +++++++++++++++++++++---- codechef/collegLife2/main_input0.txt | 5 +++++ codechef/collegLife2/main_input1.txt | 11 +++++++++++ codechef/collegLife2/main_output0.txt | 1 + codechef/collegLife2/main_output1.txt | 2 ++ 6 files changed, 40 insertions(+), 4 deletions(-) create mode 100755 codechef/collegLife2/main create mode 100644 codechef/collegLife2/main_input0.txt create mode 100644 codechef/collegLife2/main_input1.txt create mode 100644 codechef/collegLife2/main_output0.txt create mode 100644 codechef/collegLife2/main_output1.txt (limited to 'codechef/collegLife2') diff --git a/codechef/collegLife2/main b/codechef/collegLife2/main new file mode 100755 index 0000000..40e3eb4 Binary files /dev/null and b/codechef/collegLife2/main differ 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; } } diff --git a/codechef/collegLife2/main_input0.txt b/codechef/collegLife2/main_input0.txt new file mode 100644 index 0000000..146fb12 --- /dev/null +++ b/codechef/collegLife2/main_input0.txt @@ -0,0 +1,5 @@ +1 +2 +1 2 +1 2 +2 3 4 diff --git a/codechef/collegLife2/main_input1.txt b/codechef/collegLife2/main_input1.txt new file mode 100644 index 0000000..f30cc97 --- /dev/null +++ b/codechef/collegLife2/main_input1.txt @@ -0,0 +1,11 @@ +2 +1 +10 +5 11 11 11 11 11 +5 +10 10 10 10 10 +1 11 +1 11 +1 11 +1 11 +1 11 diff --git a/codechef/collegLife2/main_output0.txt b/codechef/collegLife2/main_output0.txt new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/codechef/collegLife2/main_output0.txt @@ -0,0 +1 @@ +7 diff --git a/codechef/collegLife2/main_output1.txt b/codechef/collegLife2/main_output1.txt new file mode 100644 index 0000000..1ec0d94 --- /dev/null +++ b/codechef/collegLife2/main_output1.txt @@ -0,0 +1,2 @@ +15 +55 -- cgit v1.2.3