Submission #952976

# Submission time Handle Problem Language Result Execution time Memory
952976 2024-03-25T08:23:09 Z Alexabcde1 Remittance (JOI19_remittance) C++14
0 / 100
1 ms 2648 KB
#include<bits/stdc++.h>
#define f first
#define s second
using namespace std;
long long n;
long long a[1000005],b[1000005];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin>>n;
	for (int i=0;i<n;i++) cin>>a[i]>>b[i];
	long long cnt=50;
	while (cnt--){
		for (int i=0;i<n;i++){
			if (a[i]>b[i]){
				long long give=(a[i]-b[i])/2;
				a[i]-=give*2;
				a[(i+1)%n]+=give;
			}
		}
	}
	for (int i=0;i<n;i++){
		if (a[i]!=b[i]) {
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2512 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2512 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2512 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Incorrect 1 ms 2396 KB Output isn't correct
9 Halted 0 ms 0 KB -