Submission #538908

# Submission time Handle Problem Language Result Execution time Memory
538908 2022-03-18T02:43:00 Z Monarchuwu Remittance (JOI19_remittance) C++17
0 / 100
307 ms 440 KB
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

const int N = 1e6 + 9;
int n, nxt[N];
ll a[N], b[N];

int main() {
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i] >> b[i], a[i] -= b[i], nxt[i] = i % n + 1;

    for (int times = 0; times * n < 1e8; ++times)
        for (int i = 1; i <= n; ++i)
            if (a[i] > 0) {
                ll tmp = a[i] >> 1;
                a[i] -= tmp << 1;
                a[nxt[i]] += tmp;
            }

    ll ma = *max_element(a + 1, a + n + 1);
    ll mi = *min_element(a + 1, a + n + 1);

    if (ma == mi && (ma == 1 || ma == 0))
        cout << "Yes\n";
    else cout << "No\n";
}
/**  /\_/\
 *  (= ._.)
 *  / >0  \>1
**/
# Verdict Execution time Memory Grader output
1 Correct 99 ms 340 KB Output is correct
2 Correct 105 ms 328 KB Output is correct
3 Correct 111 ms 320 KB Output is correct
4 Correct 96 ms 212 KB Output is correct
5 Correct 84 ms 316 KB Output is correct
6 Correct 87 ms 316 KB Output is correct
7 Correct 82 ms 328 KB Output is correct
8 Correct 296 ms 320 KB Output is correct
9 Correct 89 ms 212 KB Output is correct
10 Correct 84 ms 316 KB Output is correct
11 Correct 79 ms 320 KB Output is correct
12 Correct 152 ms 212 KB Output is correct
13 Correct 96 ms 212 KB Output is correct
14 Correct 97 ms 212 KB Output is correct
15 Correct 81 ms 316 KB Output is correct
16 Correct 149 ms 440 KB Output is correct
17 Correct 91 ms 316 KB Output is correct
18 Correct 79 ms 316 KB Output is correct
19 Correct 79 ms 340 KB Output is correct
20 Incorrect 307 ms 316 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 99 ms 340 KB Output is correct
2 Correct 105 ms 328 KB Output is correct
3 Correct 111 ms 320 KB Output is correct
4 Correct 96 ms 212 KB Output is correct
5 Correct 84 ms 316 KB Output is correct
6 Correct 87 ms 316 KB Output is correct
7 Correct 82 ms 328 KB Output is correct
8 Correct 296 ms 320 KB Output is correct
9 Correct 89 ms 212 KB Output is correct
10 Correct 84 ms 316 KB Output is correct
11 Correct 79 ms 320 KB Output is correct
12 Correct 152 ms 212 KB Output is correct
13 Correct 96 ms 212 KB Output is correct
14 Correct 97 ms 212 KB Output is correct
15 Correct 81 ms 316 KB Output is correct
16 Correct 149 ms 440 KB Output is correct
17 Correct 91 ms 316 KB Output is correct
18 Correct 79 ms 316 KB Output is correct
19 Correct 79 ms 340 KB Output is correct
20 Incorrect 307 ms 316 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 99 ms 340 KB Output is correct
2 Correct 105 ms 328 KB Output is correct
3 Correct 111 ms 320 KB Output is correct
4 Correct 96 ms 212 KB Output is correct
5 Correct 84 ms 316 KB Output is correct
6 Correct 87 ms 316 KB Output is correct
7 Correct 82 ms 328 KB Output is correct
8 Correct 296 ms 320 KB Output is correct
9 Correct 89 ms 212 KB Output is correct
10 Correct 84 ms 316 KB Output is correct
11 Correct 79 ms 320 KB Output is correct
12 Correct 152 ms 212 KB Output is correct
13 Correct 96 ms 212 KB Output is correct
14 Correct 97 ms 212 KB Output is correct
15 Correct 81 ms 316 KB Output is correct
16 Correct 149 ms 440 KB Output is correct
17 Correct 91 ms 316 KB Output is correct
18 Correct 79 ms 316 KB Output is correct
19 Correct 79 ms 340 KB Output is correct
20 Incorrect 307 ms 316 KB Output isn't correct
21 Halted 0 ms 0 KB -