| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 209747 | mhy908 | 송금 (JOI19_remittance) | C++14 | 411 ms | 36348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n;
LL a[1000010], b[1000010];
bool ans=true, allz=true;
int main(){
scanf("%d", &n);
for(int i=0; i<n; i++){
scanf("%lld %lld", &a[i], &b[i]);
if(b[i])allz=false;
if(a[i]!=b[i])ans=false;
}
/*if(allz){
if(ans)puts("Yes");
else puts("No");
return 0;
}*/
while(1){
bool flag=false;
for(int i=0; i<n; i++){
if(a[i]<=b[i])continue;
LL temp=(a[i]-b[i]+1)/2;
if(a[i]-temp*2<0)continue;
a[i]-=temp*2;
a[(i+1)%n]+=temp;
flag=true;
}
for(int i=0; i<n; i++)assert(a[i]>=0);
if(!flag)break;
}
for(int i=0; i<n; i++){
if(a[i]!=b[i]){
puts("No");
return 0;
}
}
puts("Yes");
}
컴파일 시 표준 에러 (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... | ||||
