Submission #1000048

#TimeUsernameProblemLanguageResultExecution timeMemory
1000048NintsiChkhaidzeParrots (IOI11_parrots)C++17
Compilation error
0 ms0 KiB

int get(int b,int idx){
	int x = b;
	if (idx < 10) x = x*10 + idx;
	else x = x*100 + idx;
	return x;
}

void encode(int N, int M[]){
	int id = -1;
	for (int i = 0; i < N; i++){
		int x = M[i];
		
		for (int j = 8; j >= 0; j--){
			if (((x >> j) & 1)){
				xx[++id] = get(j + 1,i);
			}
		}
	}
	
	len = id + 1;
	for (int i=0;i<=id;i++)
		send(xx[i]);
}
void decode(int N, int L, int X[]){
	for (int i = 0; i < len; i++){
		int x = X[i];
		int A = 0,B = 0;
		if (x < 100) A = x/10,B = x%10;
		else A = x/100,B = x - A*100;
		
		yy[B] |= (1<<(A - 1));
	}
	
	for (int i=0;i<N;i++)
		output(yy[i]);
}

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:16:5: error: 'xx' was not declared in this scope; did you mean 'x'?
   16 |     xx[++id] = get(j + 1,i);
      |     ^~
      |     x
encoder.cpp:21:2: error: 'len' was not declared in this scope
   21 |  len = id + 1;
      |  ^~~
encoder.cpp:23:8: error: 'xx' was not declared in this scope
   23 |   send(xx[i]);
      |        ^~
encoder.cpp:23:3: error: 'send' was not declared in this scope
   23 |   send(xx[i]);
      |   ^~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:2:22: error: 'len' was not declared in this scope
    2 |  for (int i = 0; i < len; i++){
      |                      ^~~
decoder.cpp:8:3: error: 'yy' was not declared in this scope
    8 |   yy[B] |= (1<<(A - 1));
      |   ^~
decoder.cpp:12:10: error: 'yy' was not declared in this scope
   12 |   output(yy[i]);
      |          ^~
decoder.cpp:12:3: error: 'output' was not declared in this scope
   12 |   output(yy[i]);
      |   ^~~~~~