답안 #144360

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
144360 2019-08-16T17:52:23 Z brcode Potatoes and fertilizers (LMIO19_bulves) C++14
24 / 100
559 ms 14968 KB
#include <iostream>

using namespace std;
const long long MAXN = 5e5+5;
long long arr[MAXN];
long long pref[MAXN];
int main(){
    long long n;
    cin>>n;
    for(long long i=1;i<=n;i++){
        long long a,b;
        cin>>a>>b;
        arr[i] = a-b;
        pref[i] = pref[i-1]+arr[i];
    }
    long long ans = 0;
    for(long long i=1;i<=n;i++){
        ans+=abs(pref[i]);
    }
    cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 36 ms 1116 KB Output is correct
5 Correct 74 ms 2552 KB Output is correct
6 Correct 279 ms 7568 KB Output is correct
7 Correct 559 ms 14968 KB Output is correct
8 Correct 449 ms 13012 KB Output is correct
9 Correct 406 ms 12444 KB Output is correct
10 Correct 268 ms 10104 KB Output is correct
11 Correct 265 ms 10164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 36 ms 1116 KB Output is correct
5 Correct 74 ms 2552 KB Output is correct
6 Correct 279 ms 7568 KB Output is correct
7 Correct 559 ms 14968 KB Output is correct
8 Correct 449 ms 13012 KB Output is correct
9 Correct 406 ms 12444 KB Output is correct
10 Correct 268 ms 10104 KB Output is correct
11 Correct 265 ms 10164 KB Output is correct
12 Incorrect 140 ms 4048 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -