Submission #942351

# Submission time Handle Problem Language Result Execution time Memory
942351 2024-03-10T13:34:19 Z dshfjka Remittance (JOI19_remittance) C++14
0 / 100
43 ms 416 KB
#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL maks=5e7;
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;
				arr[b]-=diff;
				arr[(b+1)%n]+=diff/2;
			}
		}
	}
//	printf("SINI\n");
	for(LL a=1;a<=n;a++)
	{
		if(arr[a]!=brr[a])
		{
			printf("No\n");
			exit(0);
		}
	}
	printf("Yes\n");
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  scanf("%lld",&n);
      |  ~~~~~^~~~~~~~~~~
remittance.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |   scanf("%lld %lld",&arr[a],&brr[a]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 32 ms 416 KB Output is correct
2 Incorrect 43 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 416 KB Output is correct
2 Incorrect 43 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 416 KB Output is correct
2 Incorrect 43 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -