Submission #199430

# Submission time Handle Problem Language Result Execution time Memory
199430 2020-02-01T12:16:48 Z TAISA_ Remittance (JOI19_remittance) C++14
0 / 100
6 ms 380 KB
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=(1LL<<40);
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;cin>>n;
	vector<ll> a(n),b(n);
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	bool f=true;
	while(1){
		for(int i=0;i<n;i++){
			if(a[i]<b[i]){
				f=false;
				break;
			}
			ll c=(a[i]-b[i]+1LL)/2LL;
			a[i]-=2LL*c;
			a[(i+1)%n]+=c;
		}
		if(!f){
			break;
		}
		bool f2=true;
		for(int i=0;i<n;i++){
			if(a[i]!=b[i]){
				f2=false;
			}
		}
		if(f2){
			break;
		}
	}
	if(f){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Incorrect 6 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Incorrect 6 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Incorrect 6 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -