# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
522791 | CPSC | Remittance (JOI19_remittance) | C++14 | 804 ms | 28688 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;
const int N = 1e6 + 5;
int a[N],b[N],val,ff,n;
main() {
cin>>n;
int ff = 0;
int ff1 = 0;
for (int i = 1; i <= n; i++) {
cin>>a[i]>>b[i];
if (b[i] != 0) ff = 1;
if (a[i] != 0) ff1 = 1;
}
if (!ff) {
if (ff1) cout<<"No"<<endl; else cout<<"Yes"<<endl;
return 0;
}
while (true) {
ff = 0;
for (int i = 1; i <= n; i++) {
if (a[i] > b[i]) {
val = (a[i] - b[i] + 1) / 2; val *= 2;
if (i == n) {
a[i] -= val;
a[1] += val/2;
} else a[i] -= val, a[i + 1] += val / 2;
ff = 1;
}
}
if (!ff) break;
}
for (int i = 1; i <= n; i++) {
if (a[i] != b[i]) {
cout<<"No"<<endl; exit(0);
}
}
cout<<"Yes"<<endl;
}
컴파일 시 표준 에러 (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... |