이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
signed main() {
int n; cin>>n;
vector<pair<int64_t,int64_t>>v(n);
for(auto &z : v)
cin>>z.first>>z.second;
for(int i = 0 ; i < 10 ; i++) {
for(int ii = 0 ; ii < n-1 ; ii++) {
int64_t d = max(0LL, (v[ii].first - v[ii].second)/2LL);
v[ii].first -= 2LL*d;
v[ii+1].first += d;
}
int d = max(0LL, (v[n-1].first - v[n-1].second)/2LL);
v[n-1].first -= 2LL*d;
v[0].first += d;
}
bool ok = 1;
for(int i = 0 ; i < n ; i++) {
if(v[i].first != v[i].second)
ok = 0;
}
cout << (ok ? "Yes" : "No");
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |