Submission #564131

# Submission time Handle Problem Language Result Execution time Memory
564131 2022-05-18T15:24:29 Z 4fecta Remittance (JOI19_remittance) C++17
0 / 100
20 ms 15988 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)

const int MN = 1000005;

int n;
pii a[2 * MN];

int32_t main() {
    boost();

    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i].f >> a[i].s;
    for (int i = 0; i < MN; i++) {
        if (a[i].s > a[i].f) {
            int d = a[i].s - a[i].f;
            a[i].s -= d;
            a[i + n].s += d;
        }
        int d = a[i].f - a[i].s;
        int tk = (d + 1) / 2;
        a[i].f -= tk * 2;
        a[i + 1].f += tk;
        if (a[i].s > a[i].f) {
            int d = a[i].s - a[i].f;
            a[i].s -= d;
            a[i + n].s += d;
        }
    }
    for (int i = 0; i < MN * 2; i++) if (a[i].f != a[i].s) return 0 * printf("No\n");
    printf("Yes\n");

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 14 ms 15956 KB Output is correct
2 Correct 14 ms 15956 KB Output is correct
3 Correct 14 ms 15940 KB Output is correct
4 Correct 16 ms 15976 KB Output is correct
5 Correct 20 ms 15956 KB Output is correct
6 Correct 14 ms 15956 KB Output is correct
7 Correct 16 ms 15988 KB Output is correct
8 Correct 14 ms 15956 KB Output is correct
9 Correct 14 ms 15920 KB Output is correct
10 Correct 14 ms 15924 KB Output is correct
11 Correct 14 ms 15988 KB Output is correct
12 Correct 14 ms 15984 KB Output is correct
13 Correct 12 ms 15988 KB Output is correct
14 Correct 12 ms 15952 KB Output is correct
15 Correct 12 ms 15952 KB Output is correct
16 Correct 15 ms 15956 KB Output is correct
17 Correct 14 ms 15956 KB Output is correct
18 Correct 14 ms 15956 KB Output is correct
19 Correct 15 ms 15948 KB Output is correct
20 Incorrect 15 ms 15900 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 15956 KB Output is correct
2 Correct 14 ms 15956 KB Output is correct
3 Correct 14 ms 15940 KB Output is correct
4 Correct 16 ms 15976 KB Output is correct
5 Correct 20 ms 15956 KB Output is correct
6 Correct 14 ms 15956 KB Output is correct
7 Correct 16 ms 15988 KB Output is correct
8 Correct 14 ms 15956 KB Output is correct
9 Correct 14 ms 15920 KB Output is correct
10 Correct 14 ms 15924 KB Output is correct
11 Correct 14 ms 15988 KB Output is correct
12 Correct 14 ms 15984 KB Output is correct
13 Correct 12 ms 15988 KB Output is correct
14 Correct 12 ms 15952 KB Output is correct
15 Correct 12 ms 15952 KB Output is correct
16 Correct 15 ms 15956 KB Output is correct
17 Correct 14 ms 15956 KB Output is correct
18 Correct 14 ms 15956 KB Output is correct
19 Correct 15 ms 15948 KB Output is correct
20 Incorrect 15 ms 15900 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 15956 KB Output is correct
2 Correct 14 ms 15956 KB Output is correct
3 Correct 14 ms 15940 KB Output is correct
4 Correct 16 ms 15976 KB Output is correct
5 Correct 20 ms 15956 KB Output is correct
6 Correct 14 ms 15956 KB Output is correct
7 Correct 16 ms 15988 KB Output is correct
8 Correct 14 ms 15956 KB Output is correct
9 Correct 14 ms 15920 KB Output is correct
10 Correct 14 ms 15924 KB Output is correct
11 Correct 14 ms 15988 KB Output is correct
12 Correct 14 ms 15984 KB Output is correct
13 Correct 12 ms 15988 KB Output is correct
14 Correct 12 ms 15952 KB Output is correct
15 Correct 12 ms 15952 KB Output is correct
16 Correct 15 ms 15956 KB Output is correct
17 Correct 14 ms 15956 KB Output is correct
18 Correct 14 ms 15956 KB Output is correct
19 Correct 15 ms 15948 KB Output is correct
20 Incorrect 15 ms 15900 KB Output isn't correct
21 Halted 0 ms 0 KB -