Submission #1148945

#TimeUsernameProblemLanguageResultExecution timeMemory
1148945IssaRemittance (JOI19_remittance)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ent "\n"

const int maxn = 1e6 + 100;
const ll INF = (ll)1e18 + 100;
const int inf = 1e7 + 100;
const ll MOD = 1e9 + 7;
const int maxl = 16;
const ll P = 31;

int n;
ll a[maxn];
ll b[maxn];
ll d[maxn];
ll c[maxn];

void test(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
	} a[n] = a[0]; b[n] = b[0];
	for(int i = 0; i < n; i++){
		if(1 & (a[i+1] ^ b[i+1])) c[i] = 1;
	} c[n] = c[0];
	for(int k = 1; k < 50; k++){
		for(int i = 0; i < n; i++){
			if(((c[i] + a[i+1] - b[i+1])>>1) % (1ll<<k) != c[i+1]){
				c[i] |= (1ll<<k);
			}
		} c[n] = c[0];
	}
	int s = 0;
	while(s < n && a[s] < c[s] * 2) s++;
	if(s == n){
		cout << "No\n";
		return;
	} cout << "Yes\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int t; t = 1;
	while(t--) test();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...