답안 #970032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970032 2024-04-26T07:07:10 Z efedmrlr 송금 (JOI19_remittance) C++17
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>

#define lli long long int
#define pb push_back
#define MP make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
#define ld long double

using namespace std;

void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int N = 1e6 + 5;
const int INF = 1e9 + 500;
const int LGN = 45;
int n;
vector<int> a, b;
void solve() {
    cin >> n;
    a.resize(n + 1); b.resize(n + 1);
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    } 
    for(int k = 0; k < LGN; k++) {
        bool f = 0;
        for(int i = 0; i < n; i++) {
            int j = (i + 1) % n;
            if(b[i] >= a[i]) continue;
            f = 1;
            int nxt = (a[i] - b[i]) / 2;
            a[i] -= nxt * 2;
            a[j] += nxt;
        }
        if(!f) break; 
    }
    bool f = 1;
    for(int i = 0; i < n; i++) {
        if(a[i] != b[i]) {
            f = 0;
            break;
        }
    }
    if(f) cout << "Yes\n";
    else cout << "No\n";
}

signed main() {
    fastio();
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Halted 0 ms 0 KB -