제출 #1039714

#제출 시각아이디문제언어결과실행 시간메모리
1039714phong송금 (JOI19_remittance)C++17
0 / 100
1 ms460 KiB
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

#define ll long long
const int nmax = 1e6 + 5, N = 1e5;
const ll oo = 1e9;
const int lg = 31, M = 2, mod = 1e6;
#define pii pair<ll, ll>
#define fi first
#define se second
#define debug(a, n) for(int i = 1; i <= n; ++i) cout << a[i] << ' '; cout << "\n";
#define endl "\n"
#define task "code"
using namespace std;

int n;
pii a[nmax];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
//    freopen(task".inp", "r", stdin);
//    freopen(task".out", "w", stdout);
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> a[i].fi >> a[i].se;
    int bs = 60;
    while(bs--){
        for(int i = 0; i < n; ++i){
            if(a[i].fi > a[i].se){
                ll x = (a[i].fi - a[i].se) / 2;
                a[i].fi -= x * 2;
                a[(i + 1) % n].fi += x;
            }
        }
    }
    bool ok = 1;
//    cout << endl;
    for(int i = 0; i < n;++i){
        ok &= (a[i].fi == a[i].se);
    }
    if(ok) cout << "Yes", exit(0);
    bs = 60;
    while(bs--){
        bool idx = 1;
        for(int i = 0; i < n; ++i){
            if(a[i].fi > a[i].se){
                ll x = (a[i].fi - a[i].se + idx) / 2;
                a[i].fi -= x * 2;
                a[(i + 1) % n].fi += x;
                idx = 0;
            }
        }
    }
    ok = 1;
    for(int i = 0; i < n;++i){
        ok &= (a[i].fi == a[i].se);
    }
    if(ok) cout << "Yes", exit(0);
    cout << "No";
}
/*
3 5
12345678
000
0??
1?0
?11
???

3 1
12345678
???
*/

컴파일 시 표준 에러 (stderr) 메시지

remittance.cpp:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   20 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...