# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
779607 | shoryu386 | 송금 (JOI19_remittance) | C++17 | 1 ms | 304 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
main(){
int n; cin >> n;
int a[n], b[n]; for (int x = 0;x < n; x++) cin >> a[x] >> b[x];
#define SUS 40000
for (int y = 0; y < SUS; y++){
for (int x = 0; x < n; x++){
if (a[x] >= b[x] + 2){
int trans = (a[x] - b[x])/2;
a[x] -= 2*trans;
if (x != n-1) a[x+1] += trans;
else a[0] += trans;
}
}
}
bool wtf = true;
for (int x = 0; x < n; x++){
//if (a[x] >= b[x] + 2) assert(false);
if (a[x] != b[x]) wtf = false;
}
if (wtf) cout << "Yes";
else {
for (int y = 0; y < SUS; y++){
for (int x = 0; x < n; x++){
if (a[x] > b[x]){
a[x] -= 2;
if (x != n-1) a[x+1] += 1;
else a[0] += 1;
}
}
}
wtf = true;
for (int x = 0; x < n; x++){
//if (a[x] >= b[x] + 2) assert(false);
if (a[x] != b[x]) wtf = false;
}
if (wtf) cout << "Yes";
else {
cout << "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... |