#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int64_t a[n],b[n];
for(int i = 0;i < n;++i)
{
cin >> a[i] >> b[i];
}
int64_t tp = 0;
for(int i = 0;i < 10*n;++i)
{
int j = i%n;
a[j] += tp;
if(a[j] > b[j])
{
tp = (a[j]-b[j])/2;
a[j] = b[j] + (a[j]-b[j])%2;
}
else
tp = 0;
}
int no = 0;
for(int i = 0;i < n;++i)
{
if(a[i] != b[i])
no = 1;
}
cout << (no ? "No\n" : "Yes\n");
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |