Submission #590687

#TimeUsernameProblemLanguageResultExecution timeMemory
590687Jakub_WozniakPotatoes and fertilizers (LMIO19_bulves)C++14
24 / 100
270 ms10844 KiB
#include <bits/stdc++.h> using namespace std; long int bezw(long int j) { if(j<0) j*=-1; return j; } int main() { int N; cin >> N; int A[N+1],B[N+1]; for(int i=0;i<N;i++) { cin >> A[i] >> B[i]; } long int nadmiar=0; long int wynik=0; for(int i=0;i<N;i++) { nadmiar+=A[i]-B[i]; wynik+=bezw(nadmiar); } cout << wynik; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...