# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
354410 | rqi | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 5645 ms | 25008 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;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define ins insert
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
const int maxh = 12;
vector<vector<bool>> subs;
void genSub(){
vector<bool> sub;
for(int i = 0; i < maxh/2; i++){
sub.pb(0);
}
for(int i = maxh/2; i < maxh; i++){
sub.pb(1);
}
do{
subs.pb(sub);
}
while(next_permutation(all(sub)));
}
bool calculated = false;
void precalc(){
if(calculated) return;
calculated = true;
genSub();
}
int encode (int n, int x, int y) {
precalc();
x--;
y--;
for(int i = 0; i < maxh; i++){
if(subs[x][i] && !subs[y][i]){
return i+1;
}
}
return -1;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define ins insert
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
const int maxh = 12;
vector<vector<bool>> subs;
void genSub(){
vector<bool> sub;
for(int i = 0; i < maxh/2; i++){
sub.pb(0);
}
for(int i = maxh/2; i < maxh; i++){
sub.pb(1);
}
do{
subs.pb(sub);
}
while(next_permutation(all(sub)));
}
bool calculated = false;
void precalc(){
if(calculated) return;
calculated = true;
genSub();
}
int decode (int n, int q, int h) {
precalc();
q--;
if(subs[q][h-1]) return 1;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |