답안 #236862

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
236862 2020-06-03T15:20:25 Z egekabas 송금 (JOI19_remittance) C++14
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<int, int>    pii;
typedef pair<ull, ull>    pull;
typedef pair<ld, ld>  pld;
ll a[1000009];
ll b[1000009];
ll n;
int main() {
    
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    
    cin >> n;
    for(ll i = 0; i < n; ++i)
        cin >> a[i] >> b[i];
    ll cnt = 100;
    while(cnt--){
        for(ll i = 0; i < n; ++i){
            ll dif = a[i]-b[i];
            if(dif > 0){
                a[i] -= dif/2*2;
                a[(i+1)%n] += dif/2;
            }
        }
    }
    for(ll i = 0; i < n; ++i){
        if(a[i] != b[i]){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Incorrect 5 ms 256 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Incorrect 5 ms 256 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Incorrect 5 ms 256 KB Output isn't correct
9 Halted 0 ms 0 KB -