# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
471355 | lovrot | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++11 | 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;
bool breakb = false;
vector<int> out;
int m;
void shuffle(int x, int pos, int par){
//cout << x << ' ' << pos << ' ' << par << "\n";
if(breakb) return;
cout << x << ' ' << pos << "\n";
if(pos >= 12){
out.push_back(par);
if(out.size() > m)
breakb = true;
return;
}
if(x)
shuffle(x - 1, pos + 1, par ^ (1 << pos));
if(12 - pos > x)
shuffle(x, pos + 1, par);
}
int encode(int n, int x, int y){
ios_base::sync_with_stdio(false);
m = n;
shuffle(6, 0, 0);
for (int i = 0; i < 12; i++)
if ((out[x] & (1 << i)) && (!(out[y] & (1 << i))))
return i+1;
}
#include <bits/stdc++.h>
using namespace std;
bool breakb = false;
vector<int> out;
int m;
void shuffle(int x, int pos, int par){
//cout << x << ' ' << pos << ' ' << par << "\n";
if(breakb) return;
cout << x << ' ' << pos << "\n";
if(pos >= 12){
out.push_back(par);
if(out.size() > m)
breakb = true;
return;
}
if(x)
shuffle(x - 1, pos + 1, par ^ (1 << pos));
if(12 - pos > x)
shuffle(x, pos + 1, par);
}
int encode(int n, int q, int h){
ios_base::sync_with_stdio(false);
shuffle(6, 0, 0);
m = n;
if(out[q] & (1 << h - 1)) return 1;
return 0;
}