| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1325142 | brendonw | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, t;
cin >> n >> t;
while (t--) {
int x, y;
cin >> x >> y;
if ((x & 1) != (y & 1)) {
if (x & 1) {
cout << 1 << '\n';
} else {
cout << 20 << '\n';
}
continue;
}
for (int i = 1; i < 10; ++i) {
if ((x >> i & 1) != (y >> i & 1)) {
cout << 2 * i + (x >> i & 1) << '\n';
break;
}
}
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, t;
cin >> n >> t;
while (t--) {
int q, h;
cin >> q >> h;
int bit = h & 1, shift = h / 2;
if (h == 20) {
bit = 0, shift = 0;
}
if ((q >> shift & 1) == bit) {
cout << "yes\n";
} else {
cout << "no\n";
}
}
}