답안 #502851

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
502851 2022-01-06T16:12:42 Z amunduzbaev 송금 (JOI19_remittance) C++14
0 / 100
1 ms 204 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];
	}
	
	bool is = 1;
	while(is){
		is = 0;
		for(int i=0;i<n;i++){
			if(a[i] <= b[i]) continue;
			int x = (a[i] - b[i]);
			if(x&1) continue;
			x /= 2;
			a[(i + 1) % n] += x;
			a[i] -= 2 * x, is = 1;
		}
	}
	
	for(int i=0;i<n;i++){
		if(a[i] != b[i]){
			cout<<"No\n";
			return 0;
		}
	}
	
	cout<<"Yes\n";
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 0 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -