Submission #548232

# Submission time Handle Problem Language Result Execution time Memory
548232 2022-04-12T18:20:38 Z MilosMilutinovic Remittance (JOI19_remittance) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
const int N=1000050;
int n;
long long a[N],b[N];
int main(){
	scanf("%i",&n);
	for(int i=0;i<n;i++)scanf("%lld%lld",&a[i],&b[i]);
	for(int j=0;j<60;j++)for(int i=0;i<n;i++){
		if(a[i]<0){printf("No");return 0;}
		if(a[i]>b[i]){
			long long x=(a[i]-b[i])/2;
			a[i]-=2*x,a[(i+1)%n]+=x;
		}
	}
	bool ok=true;
	for(int i=0;i<n;i++)ok&=(a[i]==b[i]);
	puts(ok?"Yes":"No");
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%i",&n);
      |  ~~~~~^~~~~~~~~
remittance.cpp:8:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  for(int i=0;i<n;i++)scanf("%lld%lld",&a[i],&b[i]);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -