답안 #525476

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
525476 2022-02-11T18:42:46 Z PiejanVDC 송금 (JOI19_remittance) C++17
0 / 100
1 ms 204 KB
#include <bits/stdc++.h>
using namespace std;

signed main() {
    int n; cin>>n;
    vector<pair<int64_t,int64_t>>v(n);
    for(auto &z : v)
        cin>>z.first>>z.second;
    for(int i = 0 ; i < n ; i++) {
        for(int ii = 0 ; ii < n-1 ; ii++) {
            int64_t d = max(0LL, (v[ii].first - v[ii].second)/2LL);
            v[ii].first -= 2LL*d;
            v[ii+1].first += d;
        }
        int d = max(0LL, (v[n-1].first - v[n-1].second)/2LL);
            v[n-1].first -= 2LL*d;
            v[0].first += d;
    }
    bool ok = 1;
    for(int i = 0 ; i < n ; i++) {
        if(v[i].first != v[i].second)
            ok = 0;
    }
    cout << (ok ? "Yes" : "No");
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 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 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 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 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 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 -