Submission #105374

#TimeUsernameProblemLanguageResultExecution timeMemory
105374eriksuenderhauf앵무새 (IOI11_parrots)C++11
Compilation error
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"
int a[800];

void encode(int n, int M[]) {
	int cnt = 0, x = 0, y = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 7; j > -1; j--) {
			if ((M[i] >> j) & 1)
				a[cnt++] = 1;
			else
				a[cnt++] = 0;
			if (cnt % 2 == 0) {
				x += a[cnt-1] * 2 + a[cnt-2];
				y += 3 - (a[cnt-1] * 2 + a[cnt-2]);
			}
		}
	}
	if (x > y)
		send(0); send(0); send(0); send(0);
	for (int i = 0; i < cnt; i += 2)
		if (x > y)
			for (int j = 0; j < 3 - (a[i+1] * 2 + a[i]); j++)
				send(i / 2);
		else
			for (int j = 0; j < a[i+1] * 2 + a[i]; j++)
				send(i / 2);
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
int a[800], b[800];
int val[16] = {0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0};

void decode(int n, int L, int X[]) {
	std::sort(X, X + L);
	int fl = 0;
	if (L > 3 && X[0] == X[1] && X[2] == X[3] && X[0] == X[2] && X[0] == 0)
		fl = 4;
	int cur = fl;
	for (int i = 0; i < 4 * n; i++) {
		int j = cur;
		while (cur < L && X[cur] == i) cur++;
		j = cur - j;
		a2[2 * i] = val[2 * j + 2 * fl];
		a2[2 * i + 1] = val[2 * j + 1 + 2 * fl];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 7; j > -1; j--)
			b[i] |= (1 << j) * a2[8 * (i + 1) - j - 1];
		output(b[i]);
	}
}

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:19:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  if (x > y)
  ^~
encoder.cpp:20:12: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   send(0); send(0); send(0); send(0);
            ^~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:17:3: error: 'a2' was not declared in this scope
   a2[2 * i] = val[2 * j + 2 * fl];
   ^~
decoder.cpp:17:3: note: suggested alternative: 'a'
   a2[2 * i] = val[2 * j + 2 * fl];
   ^~
   a
decoder.cpp:22:23: error: 'a2' was not declared in this scope
    b[i] |= (1 << j) * a2[8 * (i + 1) - j - 1];
                       ^~
decoder.cpp:22:23: note: suggested alternative: 'a'
    b[i] |= (1 << j) * a2[8 * (i + 1) - j - 1];
                       ^~
                       a