제출 #1148931

#제출 시각아이디문제언어결과실행 시간메모리
1148931Issa송금 (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 = 2e6 + 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 < 60; 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]; } for(int i = 0; i < n; i++){ if(a[i] - c[i] * 2 + c[(i-1+n)%n] != b[i]){ cout << "No\n"; return; } } cout << "Yes\n"; // for(int i = 0; i < n; i++){ // cout << c[i] << ' '; // } cout << ent; } 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...