Submission #895972

# Submission time Handle Problem Language Result Execution time Memory
895972 2023-12-31T09:04:38 Z omsincoconut Potatoes and fertilizers (LMIO19_bulves) C++17
0 / 100
1 ms 2396 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long int lli;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef pair<lli, lli> pll;
#define mp(x, y) make_pair(x, y)

const lli MAXN = 5e5+5;

lli N;
lli a[MAXN], b[MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> N;
    for (lli i = 0; i < N; i++) cin >> a[i] >> b[i];
    lli c[N];
    for (lli i = 0; i < N; i++) c[i] = a[i] - b[i];

    lli ans = 0;
    for (lli i = 0; i < N; i++) {
        ans += c[i] + c[N-i-1];
        if (i+1 < N) c[i+1] += c[i];
        if (N-i-2 > 0) c[N-i-2] += c[N-i-1];
    }

    cout << ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -