Submission #144357

# Submission time Handle Problem Language Result Execution time Memory
144357 2019-08-16T17:51:20 Z brcode Potatoes and fertilizers (LMIO19_bulves) C++14
0 / 100
36 ms 1020 KB
#include <iostream>

using namespace std;
const int MAXN = 1e5+5;
int arr[MAXN];
int pref[MAXN];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        int a,b;
        cin>>a>>b;
        arr[i] = a-b;
        pref[i] = pref[i-1]+arr[i];
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
        ans+=abs(pref[i]);
    }
    cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 36 ms 1020 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 36 ms 1020 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 380 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -