답안 #502516

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
502516 2022-01-06T07:50:27 Z talant117408 송금 (JOI19_remittance) C++17
0 / 100
1 ms 204 KB
/*
    Code written by Talant I.D.
*/
 
#include <bits/stdc++.h>
//~ #include <ext/pb_ds/assoc_container.hpp>
 
//~ using namespace __gnu_pbds;
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
//~ typedef tree <ll, null_type, less_equal <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) ll((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;
 
const ll mod = 998244353 ;
 
ll mode(ll a) {
    a %= mod;
    while (a < 0) {
        a += mod;
    }
    return a;
}
 
ll subt(ll a, ll b) {
    return mode(mode(a)-mode(b));
}
 
ll add(ll a, ll b) {
    return mode(mode(a)+mode(b));
}
 
ll mult(ll a, ll b) {
    return mode(mode(a)*mode(b));
}
 
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b) {
        if (b&1) res = mult(res, a);
        a = mult(a, a);
        b >>= 1;
    }
    return res;
}

int main() {
    do_not_disturb
    
    int n;
    cin >> n;
    vector <ll> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        a[i] -= b[i];
    }
    
    for (int times = 0; times < 3; times++) {
        for (int i = 0; i < n; i++) {
            if (a[i] > 0) {
                a[(i+1)%n] += a[i]/2;
                a[i] %= 2;
            }
        }
    }
    
    int flag = 1;
    for (int i = 0; i < n; i++) {
        if (a[i] != 0) {
            flag = 0;
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 0 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 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 0 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 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -