답안 #757378

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
757378 2023-06-13T06:35:42 Z alexdd 송금 (JOI19_remittance) C++17
0 / 100
1 ms 288 KB
#include<bits/stdc++.h>
using namespace std;
int n;
int a[1000005];
int b[1000005];
bool running()
{
    for(int i=0;i<n;i++)
        if((a[i]-b[i])>=2)
            return 1;
    return 0;
}
signed main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    while(running())
    {
        for(int i=0;i<n;i++)
        {
            if((a[i]-b[i])>=2)
            {
                int x = (a[i]-b[i])/2;
                a[i] -= 2*x;
                a[(i+1)%n] += x;
            }
        }
    }
    bool good=1;
    for(int i=0;i<n;i++)
        if(a[i]!=b[i])
            good=0;
    if(good)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 288 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -