답안 #402926

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
402926 2021-05-12T14:15:25 Z wildturtle 송금 (JOI19_remittance) C++14
0 / 100
1 ms 204 KB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define sc second
#define pb push_back
using namespace std;
ll a,b,c,d,i,e,f,g,n,m,k,l;
pair <ll,ll> A[500005];
int main() {
    cin>>n;
    for(ll i=1;i<=n;i++) {
        cin>>A[i].f>>A[i].sc;
    }
    while(true) {
        b=0;
        for(ll i=1;i<=n;i++) {
            if(A[i].f<=A[i].sc) continue;
            a=A[i].f-A[i].sc;
            if(i==n) A[1].f+=a/2;
            else A[i+1].f+=a/2;
            if(a/2>0) b=1;
            A[i].f=A[i].sc+a%2;
        }
        if(b==0) break;
    }
    a=0;
    for(ll i=1;i<=n;i++) {
        if(A[i].f!=A[i].sc) a=1;
    }
    if(a==1) cout<<"No";
    else cout<<"Yes";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -