# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1259710 | _rain_ | 송금 (JOI19_remittance) | C++20 | 0 ms | 328 KiB |
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define FOR(i,a,b) for(int i = (a) , _b = (b); i <= _b; ++i)
#define MASK(x) ((LL)(1)<<(x))
#define BIT(mask , x) (((mask)>>x)&(1))
#define sz(x) (int)(x).size()
template<class X,class Y>
bool maximize(X &x , Y y){
if (x < y) return x = y , true; else return false;
}
template<class X,class Y>
bool minimize(X &x , Y y){
if (x > y) return x = y , true; else return false;
}
template<class T>
void compress(vector<T>&data){
sort(data.begin() , data.end());
data.resize(unique(data.begin() , data.end()) - data.begin());
}
template<class X,class Y>
int Find(vector<X>&data,Y y){
return upper_bound(data.begin() , data.end() , y) - data.begin();
}
const int MAXLOG = (int) 64;
const int N = (int)5e5;
LL diff[N + 2] = {};
int n;
int a[N + 2] , b[N + 2];
int main(){
ios::sync_with_stdio(false);
cin.tie(0) ; cout.tie(0) ;
#define name "main"
if (fopen(name".inp","r")){
freopen(name".inp","r",stdin);
freopen(name".out","w",stdout);
}
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> a[i] >> b[i];
diff[i] = a[i] - b[i];
}
for(int turn = 1; turn <= MAXLOG; ++turn){
for(int i = 1; i <= n; ++i) {
if (diff[i] > 0){
int nxt = (i % n) + 1;
LL xx = (diff[i] + 1) / 2;
diff[i] -= xx * 2;
diff[nxt] += xx;
}
}
}
for(int i = 1; i <= n; ++i) if (diff[i] != 0){
cout << "No"; return 0;
}
cout << "Yes";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |