Submission #590586

#TimeUsernameProblemLanguageResultExecution timeMemory
590586Jakub_WozniakPotatoes and fertilizers (LMIO19_bulves)C++14
0 / 100
21 ms952 KiB
#include <bits/stdc++.h> using namespace std; int bezw(int K) { if(K<0){K*=-1;} return K; } int main() { int N; cin >> N; int A[N] , B[N]; for(int i=0;i<N;i++) { cin >> A[i] >> B[i]; } int nadmiar=0,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...