| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 1210969 | nguyn | 송금 (JOI19_remittance) | C++20 | 118 ms | 8264 KiB | 
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define F first
#define S second
#define pb push_back 
#define pii pair<int,int>
const int N = 1e6 + 5;
int n;
int a[N];
int b[N];
signed main(){
    ios_base::sync_with_stdio(false) ; 
    cin.tie(0) ; cout.tie(0) ; 
    if (fopen("INP.INP" ,"r")) {
        freopen("INP.INP" ,"r" , stdin) ;
        freopen("OUT.OUT" , "w" , stdout) ;
    }
    cin >> n;
    for (int i = 1; i <= n; i++) {
    	cin >> a[i] >> b[i];
    }
    while(1) {
    	bool ok = 0;
    	for (int i = 1; i <= n; i++) {
    		int nxt = i + 1;
    		if (nxt > n) nxt = 1; 
    		if ((a[i] - b[i]) >= 2) {
    			int t = (a[i] - b[i]) / 2;
    			a[i] -= 2 * t;
    			a[nxt] += t; 
    			ok = 1;
    		} 
    	}
	    // for (int i = 1; i <= n; i++) {
	    // 	cout << a[i] << ' ';
	    // }
	    // cout << '\n';
    	if (!ok) break;
    }
    while(1) {
    	bool ok = 0;
    	for (int i = 1; i <= n; i++) {
    		int nxt = i + 1;
    		if (nxt > n) nxt = 1;
    		if (a[i] > b[i] && a[i] > 1) {
    			a[i] -= 2;
    			a[nxt]++;
    			ok = 1;
    		}
    	}
    	if (!ok) break;
    } 
    bool ok = 1;
    for (int i = 1; i <= n; i++) {
    	if (a[i] != b[i]) {
    		ok = 0;
    		break;
    	}
    }
    cout << (ok ? "Yes" : "No");
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
