Submission #677866

# Submission time Handle Problem Language Result Execution time Memory
677866 2023-01-04T13:20:31 Z puppy Remittance (JOI19_remittance) C++17
0 / 100
1 ms 312 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int n;
int a[1000005];
int b[1000005];
int x[1000005];
signed main()
{
    cin >> n;
    int tot = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        tot += (1LL << i) * (a[i] - b[i]);
    }
    if (tot % ((1 << n) - 1)) {
        cout << "No\n";
        return 0;
    }
    else x[0] = tot / ((1 << n) - 1);
    for (int i = 1; i <= n - 1; i++) {
        int p = x[i-1]+ a[i-1] - b[i-1];
        if (p % 2) {
            cout << "No\n";
            return 0;
        }
        else x[i] = p / 2;
    }
    bool ok = true;
    for (int i = 1; i <= n; i++) ok &= (x[i] >= 0);
    cout << (ok ? "Yes" : "No") << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 224 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 308 KB Output is correct
11 Correct 1 ms 312 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Incorrect 1 ms 212 KB Output isn't correct
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 224 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 308 KB Output is correct
11 Correct 1 ms 312 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Incorrect 1 ms 212 KB Output isn't correct
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 224 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 308 KB Output is correct
11 Correct 1 ms 312 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Incorrect 1 ms 212 KB Output isn't correct
18 Halted 0 ms 0 KB -