# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
433869 | 2021-06-20T11:39:57 Z | ismoilov | 송금 (JOI19_remittance) | C++14 | 1 ms | 204 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++) #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++) #define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--) #define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--) bool check(int n) { if(n==0) return 1; return (ceil(log2(n)) == floor(log2(n))); } void S() { int n; cin >> n; vector <int> b(n); fp(i,0,n){ int x, y; cin >> x >> y; b[i] = x - y; } /*if(done){ cout << "Yes"; return; }*/ // cout << endl; bool yes = 0; fp(i,0,n){ vector <int> a; a = b; if(a[i] < 0) continue; int s = a[i] / 2; a[i] %= 2; bool ok = 1; // cout << i << " " << s << endl; fpp(j,1,2*n){ a[(i+j)%n] += s; // cout << i << " " << j << " " << a[(i+j)%n] << " " << s << endl; if(a[(i+j)%n] < 0){ ok = 0; break; } s = a[(i+j)%n]/2; a[(i+j)%n] %= 2; if(j > n) ok &= (a[(i+j)%n] == 0); } yes |= (ok && s == 0); } cout << (yes ? "Yes" : "No"); } int main() { IOS; S(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Incorrect | 0 ms | 204 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Incorrect | 0 ms | 204 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Incorrect | 0 ms | 204 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |