Submission #732019

# Submission time Handle Problem Language Result Execution time Memory
732019 2023-04-28T08:53:31 Z sentheta Question (Grader is different from the original contest) (CEOI14_question_grader) C++17
100 / 100
3314 ms 24216 KB
#include<bits/stdc++.h>
using namespace std;

#define V vector
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)

V<int> b;

int encode(int N, int x, int y) {
	if(b.empty()){
		rep(i,0,1<<12) if(bitcnt(i)==6){
			b.push_back(i);
		}
	}
	// dbg(b.size());

	rep(i,0,12) if((b[x]>>i&1) && !(b[y]>>i&1)){
		return i+1;
	}
	assert(0);
}

#include<bits/stdc++.h>
using namespace std;

#define V vector
#define bitcnt(x) (__builtin_popcountll(x))
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)

V<int> a;

int decode(int N, int q, int h) {
	if(a.empty()){
		rep(i,0,1<<12) if(bitcnt(i)==6){
			a.push_back(i);
		}
	}

	h--;
	return a[q]>>h&1;
	assert(0);
}

# Verdict Execution time Memory Grader output
1 Correct 3314 ms 24112 KB Output is correct - maxh = 12
2 Correct 3283 ms 24216 KB Output is correct - maxh = 12