#include <iostream>
#include <stack>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>
using namespace std;
typedef long long ll;
ll A[22], B[22], C[22];
int main()
{
ios::sync_with_stdio(false); cin.tie(NULL);
int N; cin >> N;
for(int i=0;i<N;i++) cin >> A[i] >> B[i];
for(int i=0;i<N;i++) C[i] = B[i] - A[i];
ll X = (1<<N) - 1;
bool flag = true;
for(int i=0;i<N;i++)
{
ll tmp = 0;
for(int j=0;j<N;j++)
{
tmp += (1<<j) * C[(i+j)%N];
}
if(tmp < 0 || tmp%X != 0) flag = false;
}
if(flag) cout << "Yes\n";
else cout << "No\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |