답안 #387850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
387850 2021-04-09T09:38:53 Z Nima_Naderi 질문 (CEOI14_question_grader) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MXN = 1e4 + 10;
const ll LOG = 12;
ll Mask[MXN]; bool gen = 0;
void prep(){
 	gen = 1; ll ts = 1;
  	for(int mask = 0; mask < (1LL << 12); mask ++){
        ll pc = __builtin_popcountll(mask);
		if(pc != 6) continue;
		Mask[ts ++] = mask;
		if(ts > n) break;
	}
}
int encode (int n, int x, int y) {
  	if(!gen) prep(n);
    int h = 0, xr = Mask[x] ^ Mask[y];
    for(int i = 0; i < LOG; i ++){
        if((xr >> i) & 1LL){
			if((Mask[x] >> i) & 1LL){
				h = i;
				h ++;
				return h;
			}
    	}
    }
	return -1;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MXN = 1e4 + 10;
const ll LOG = 12;
ll Mask[MXN]; bool gen = 0;
void prep(){
 	gen = 1; ll ts = 1;
  	for(int mask = 0; mask < (1LL << 12); mask ++){
        ll pc = __builtin_popcountll(mask);
		if(pc != 6) continue;
		Mask[ts ++] = mask;
		if(ts > n) break;
	}
}
int decode (int n, int q, int h) {
  	if(!gen) prep(n);
	h --;
    q = Mask[q];
    return (((q >> h) & 1LL));
}

Compilation message

encoder.cpp: In function 'void prep()':
encoder.cpp:13:11: error: 'n' was not declared in this scope; did you mean 'yn'?
   13 |   if(ts > n) break;
      |           ^
      |           yn
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:17:19: error: too many arguments to function 'void prep()'
   17 |    if(!gen) prep(n);
      |                   ^
encoder.cpp:7:6: note: declared here
    7 | void prep(){
      |      ^~~~

decoder.cpp: In function 'void prep()':
decoder.cpp:13:11: error: 'n' was not declared in this scope; did you mean 'yn'?
   13 |   if(ts > n) break;
      |           ^
      |           yn
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:17:19: error: too many arguments to function 'void prep()'
   17 |    if(!gen) prep(n);
      |                   ^
decoder.cpp:7:6: note: declared here
    7 | void prep(){
      |      ^~~~