# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113995 | dndhk | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 1260 ms | 124544 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;
vector<int> v;
int num = 0;
int cnt = 0;
void chk(int x){
if(x==13){
if(cnt==6){
v.push_back(num);
}
return;
}
num = num * 2;
chk(x+1);
num++;
cnt++;
chk(x+1);
num/=2;
cnt--;
}
int encode (int n, int x, int y) {
if(v.empty()){
chk(1);
sort(v.begin(), v.end());
}
x = v[x-1], y = v[y-1];
int i = 1, two = 1;
while(1){
if((x&two)>0 && (y&two)==0){
return i;
}
i++;
two*=2;
}
}
#include <bits/stdc++.h>
using namespace std;
vector<int> v2;
int num2 = 0;
int cnt2 = 0;
void chk2(int x){
if(x==13){
if(cnt2==6){
v2.push_back(num2);
}
return;
}
num2 = num2 * 2;
chk2(x+1);
num2++;
cnt2++;
chk2(x+1);
num2/=2;
cnt2--;
}
int decode (int n, int q, int h) {
if(v2.empty()){
chk2(1);
sort(v2.begin(), v2.end());
}
int t = v2[q-1];
if((t & (1<<h-1))>0){
return 1;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |