Submission #740593

# Submission time Handle Problem Language Result Execution time Memory
740593 2023-05-12T18:26:54 Z alexdd Remittance (JOI19_remittance) C++17
0 / 100
1 ms 316 KB
#include<bits/stdc++.h>
using namespace std;
int dif[1000005];
int n;
bool notdone()
{
    for(int i=0; i<n; i++)
        if(dif[i]>1)
            return 1;
    return 0;
}
signed main()
{
    cin>>n;
    int a,b;
    for(int i=0; i<n; i++)
    {
        cin>>a>>b;
        dif[i]=a-b;
    }
    while(notdone())
    {
        for(int i=0; i<n; i++)
            if(dif[i]>0)
                dif[(i+1)%n]+=dif[i]/2, dif[i]%=2;
    }
    for(int i=0; i<n; i++)
    {
        if(dif[i]!=0)
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}
# 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 1 ms 312 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 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 1 ms 312 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 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 1 ms 312 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -