| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1220581 | badge881 | 송금 (JOI19_remittance) | C++20 | 148 ms | 16072 KiB | 
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MXN = 1e6 + 6;
int n;
ll A[MXN], B[MXN];
int32_t main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%lld%lld", &A[i], &B[i]);
    int i = 0, it = 0;
    while (it < n)
    {
        if (A[i] <= B[i] || (A[i] == 1 && B[i] == 0))
        {
            it++;
            (++i) %= n;
            continue;
        }
        it = 0;
        int j = i;
        while (A[j] > B[j] && !(A[j] == 1 && B[j] == 0))
        {
            ll send = (A[j] - B[j] + (B[j] != 0)) >> 1;
            A[j] -= send << 1;
            A[(++j) %= n] += send;
        }
    }
    for (int i = 0; i < n; i++)
        if (A[i] != B[i])
        {
            printf("No\n");
            return 0;
        }
    printf("Yes\n");
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
