Submission #1106587

# Submission time Handle Problem Language Result Execution time Memory
1106587 2024-10-30T17:15:36 Z Canuc80k Potatoes and fertilizers (LMIO19_bulves) C++17
24 / 100
55 ms 23624 KB
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

const ll N = 1e6 + 1;
const ll M = 1e9 + 7;

ll n;
ll a[N], b[N], f[N];

void doTest(ll testID) {
    cin >> n;
    for (int i = 1; i <= n; i ++) cin >> a[i] >> b[i];

    ll res = 0;
    for (int i = 1; i <= n; i ++) f[i] = f[i - 1] + (a[i] - b[i]);
    for (int i = 1; i <= n; i ++) res += abs(f[i]);
    cout << res;
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int test = 1; 
    // cin >> test;
    for (int _ = 1; _ <= test; _ ++) doTest(_);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Correct 1 ms 4608 KB Output is correct
4 Correct 6 ms 6992 KB Output is correct
5 Correct 9 ms 9296 KB Output is correct
6 Correct 29 ms 14160 KB Output is correct
7 Correct 55 ms 23624 KB Output is correct
8 Correct 45 ms 21832 KB Output is correct
9 Correct 43 ms 21200 KB Output is correct
10 Correct 33 ms 19024 KB Output is correct
11 Correct 33 ms 19036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Correct 1 ms 4608 KB Output is correct
4 Correct 6 ms 6992 KB Output is correct
5 Correct 9 ms 9296 KB Output is correct
6 Correct 29 ms 14160 KB Output is correct
7 Correct 55 ms 23624 KB Output is correct
8 Correct 45 ms 21832 KB Output is correct
9 Correct 43 ms 21200 KB Output is correct
10 Correct 33 ms 19024 KB Output is correct
11 Correct 33 ms 19036 KB Output is correct
12 Incorrect 15 ms 12632 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Incorrect 1 ms 4432 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Correct 1 ms 4608 KB Output is correct
4 Incorrect 1 ms 4432 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4432 KB Output is correct
2 Correct 1 ms 4432 KB Output is correct
3 Correct 1 ms 4608 KB Output is correct
4 Incorrect 1 ms 4432 KB Output isn't correct
5 Halted 0 ms 0 KB -