# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
288916 | PeppaPig | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, T;
vector<int> vec = {0};
void A() {
scanf("%d %d", &n, &T);
for(int t = 1, a, b; t <= T; t++) {
scanf("%d %d", &a, &b);
a = vec[a], b = vec[b];
for(int i = 0; i < 12; i++) if((a >> i & 1) && !(b >> i & 1)) {
printf("%d\n", i + 1);
break;
}
}
}
void B() {
scanf("%d %d", &n, &T);
for(int t = 1, a, b; t <= T; t++) {
scanf("%d %d", &a, &b);
a = vec[a];
if(a >> (b - 1) & 1) printf("yes\n");
else printf("no\n");
}
}
int main() {
for(int i = 0; i < (1 << 12); i++) if(__builtin_popcount(i) == 6)
vec.emplace_back(i);
scanf("%d", &n);
n == 1 ? A() : B();
return 0;
}