답안 #542842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
542842 2022-03-28T09:00:08 Z colossal_pepe 송금 (JOI19_remittance) C++17
0 / 100
1 ms 384 KB
#include <iostream>
using namespace std;

const int MAXN = 1e6;

int n, a[MAXN + 5], b[MAXN + 5];

bool isEqual() {
    for (int i = 0; i < n; i++) {
        if (a[i] != b[i]) return 0;
    }
    return 1;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < n; j++) {
            int k = (j + 1) % n;
            if (a[j] > b[j]) {
                int x = (a[j] - b[j]) / 2;
                a[j] -= (2 * x);
                a[k] += x;
            }
        }
    }
    cout << (isEqual() ? "Yes" : "No") << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 1 ms 220 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 1 ms 220 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 1 ms 220 KB Output isn't correct
9 Halted 0 ms 0 KB -