Submission #502791

# Submission time Handle Problem Language Result Execution time Memory
502791 2022-01-06T15:20:43 Z amunduzbaev Remittance (JOI19_remittance) C++14
0 / 100
1 ms 324 KB
#include "bits/stdc++.h"
using namespace std;

#define ar array
#define int long long

signed main(){
	ios::sync_with_stdio(0); cin.tie(0);

	int n; cin>>n;
	vector<int> a(n), b(n);
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	
	for(int j=0;j<3;j++){
		for(int i=0;i<n;i++){
			if(a[i] <= b[i]) continue;
			int x = (a[i] - b[i]) / 2;
			a[(i + 1) % n] += x;
			a[i] -= 2 * x;
		}
	}
	
	for(int i=0;i<n;i++){
		if(a[i] != b[i]){
			cout<<"No\n";
			return 0;
		}
	}
	
	cout<<"Yes\n";
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 312 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 312 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 312 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -