답안 #972470

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
972470 2024-04-30T13:16:23 Z 12345678 송금 (JOI19_remittance) C++17
0 / 100
1 ms 2484 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=1e6+5;

int n, a[nx], b[nx], lst;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=0; i<n; i++) cin>>a[i]>>b[i];
    while (1)
    {
        for (int i=0; i<n; i++)
        {
            lst++;
            if (a[i]>b[i]+1) a[(i+1)%n]+=(a[i]-b[i])/2, a[i]-=((a[i]-b[i])/2)*2, lst=0;
            if (lst==2*n)
            {
                for (int j=0; j<n; j++) if (a[j]!=b[j]) return cout<<"No", 0;
                return cout<<"Yes", 0;
            }
        }
        //cout<<"debug ";
        //for (int i=0; i<n; i++) cout<<a[i]<<' ';
        //cout<<'\n';
    }
}

/*
5
0 0
0 0
0 0
0 1
16 0
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2484 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2484 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2484 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -