Submission #387847

# Submission time Handle Problem Language Result Execution time Memory
387847 2021-04-09T09:38:01 Z Nima_Naderi Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
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;
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:3:7: error: 'll' does not name a type
    3 | const ll MXN = 1e4 + 10;
      |       ^~
encoder.cpp:4:7: error: 'll' does not name a type
    4 | const ll LOG = 12;
      |       ^~
encoder.cpp:5:1: error: 'll' does not name a type
    5 | ll Mask[MXN]; bool gen = 0;
      | ^~
encoder.cpp: In function 'void prep()':
encoder.cpp:7:12: error: 'll' was not declared in this scope
    7 |   gen = 1; ll ts = 1;
      |            ^~
encoder.cpp:9:11: error: expected ';' before 'pc'
    9 |         ll pc = __builtin_popcountll(mask);
      |           ^~~
      |           ;
encoder.cpp:10:6: error: 'pc' was not declared in this scope
   10 |   if(pc != 6) continue;
      |      ^~
encoder.cpp:11:3: error: 'Mask' was not declared in this scope; did you mean 'mask'?
   11 |   Mask[ts ++] = mask;
      |   ^~~~
      |   mask
encoder.cpp:11:8: error: 'ts' was not declared in this scope; did you mean 'tm'?
   11 |   Mask[ts ++] = mask;
      |        ^~
      |        tm
encoder.cpp:12:11: error: 'n' was not declared in this scope; did you mean 'yn'?
   12 |   if(ts > n) break;
      |           ^
      |           yn
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:16:19: error: too many arguments to function 'void prep()'
   16 |    if(!gen) prep(n);
      |                   ^
encoder.cpp:6:6: note: declared here
    6 | void prep(){
      |      ^~~~
encoder.cpp:17:21: error: 'Mask' was not declared in this scope
   17 |     int h = 0, xr = Mask[x] ^ Mask[y];
      |                     ^~~~
encoder.cpp:18:24: error: 'LOG' was not declared in this scope
   18 |     for(int i = 0; i < LOG; i ++){
      |                        ^~~

decoder.cpp:3:7: error: 'll' does not name a type
    3 | const ll MXN = 1e4 + 10;
      |       ^~
decoder.cpp:4:7: error: 'll' does not name a type
    4 | const ll LOG = 12;
      |       ^~
decoder.cpp:5:1: error: 'll' does not name a type
    5 | ll Mask[MXN]; bool gen = 0;
      | ^~
decoder.cpp: In function 'void prep()':
decoder.cpp:7:12: error: 'll' was not declared in this scope
    7 |   gen = 1; ll ts = 1;
      |            ^~
decoder.cpp:9:11: error: expected ';' before 'pc'
    9 |         ll pc = __builtin_popcountll(mask);
      |           ^~~
      |           ;
decoder.cpp:10:6: error: 'pc' was not declared in this scope
   10 |   if(pc != 6) continue;
      |      ^~
decoder.cpp:11:3: error: 'Mask' was not declared in this scope; did you mean 'mask'?
   11 |   Mask[ts ++] = mask;
      |   ^~~~
      |   mask
decoder.cpp:11:8: error: 'ts' was not declared in this scope; did you mean 'tm'?
   11 |   Mask[ts ++] = mask;
      |        ^~
      |        tm
decoder.cpp:12:11: error: 'n' was not declared in this scope; did you mean 'yn'?
   12 |   if(ts > n) break;
      |           ^
      |           yn
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:16:19: error: too many arguments to function 'void prep()'
   16 |    if(!gen) prep(n);
      |                   ^
decoder.cpp:6:6: note: declared here
    6 | void prep(){
      |      ^~~~
decoder.cpp:18:9: error: 'Mask' was not declared in this scope
   18 |     q = Mask[q];
      |         ^~~~