# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
942362 | dshfjka | Remittance (JOI19_remittance) | C++14 | 611 ms | 36284 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL maks=1e8;
int main()
{
LL n;
scanf("%lld",&n);
LL arr[n+5],brr[n+5];
for(LL a=0;a<n;a++)
{
scanf("%lld %lld",&arr[a],&brr[a]);
}
for(LL a=1;a<=maks/n;a++)
{
for(LL b=0;b<n;b++)
{
if(arr[b]>brr[b])
{
LL diff=arr[b]-brr[b];
if(diff&1)diff++;
if((brr[b]==0) && (arr[b]&1))diff-=2;
// printf("%lld : diff=%lld\n",b,diff);
arr[b]-=diff;
arr[(b+1)%n]+=(diff/2);
// printf("arr[%lld] = %lld\n",b,arr[b]);
// printf("arr[%lld] = %lld dan arr[%lld] = %lld\n",b,arr[b],(b+1)%n,arr[(b+1)%n]);
}
}
}
// printf("SINI\n");
for(LL a=0;a<n;a++)
{
// printf("%lld dan %lld\n",arr[a],brr[a]);
if(arr[a]!=brr[a])
{
printf("No\n");
exit(0);
}
}
printf("Yes\n");
}
Compilation message (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... |