Submission #221454

#TimeUsernameProblemLanguageResultExecution timeMemory
221454emil_physmathParrots (IOI11_parrots)C++17
Compilation error
0 ms0 KiB
#include "parrots.h" #include <iostream> #include <set> #include <map> using namespace std; const int n_bits = 5; multiset<int> code1[256]; map<multiset<int>, int> coderev1; void Init1() { static int cnt = 0; static set<multiset<int> > usedcodes; int a[5]; #define specfor(i) for (a[(i)] = 0; a[(i)] < (1 << (8 - n_bits)) && cnt < 256; ++a[(i)]) specfor(0) specfor(1) specfor(2) specfor(3) specfor(4) { multiset<int> curcode(a, a + 5); if (usedcodes.find(curcode) != usedcodes.end()) continue; coderev1[curcode] = cnt; code1[cnt++] = curcode; usedcodes.insert(curcode); } } multiset<int> code2[256]; map<multiset<int>, int> coderev2; void Init2() { static int cnt = 0; static set<multiset<int> > usedcodes; if (cnt == 256) return; coderev2[multiset<int>()] = 0; code2[0] = multiset<int>(); cnt = 1; int a[15]; for (int j = 1; j <= 7 && cnt < 256; ++j) #define specfor(i) for (a[(i)] = 0; a[(i)] < (1 << (8 - (n_bits + 1))) && cnt < 256; ++a[(i)]) specfor(0) specfor(1) specfor(2) specfor(3) specfor(4) specfor(5) specfor(6) { { multiset<int> curcode(a, a + j); if (usedcodes.find(curcode) != usedcodes.end()) continue; coderev2[curcode] = cnt; code2[cnt++] = curcode; usedcodes.insert(curcode); cerr << cnt << '\t'; } } } void encode(int n, int a[]) { if (n <= 32) Init1(); else Init2(); auto& code = (n <= 32 ? code1 : code2); int nbits = n_bits; if (n > 32) ++nbits; for (int i = 0; i < n; ++i) for (int y: code[a[i]]) send(i | (y << nbits)); } multiset<int> got[256]; void decode(int n, int l, int x[]) { int nbits = n_bits; if (n <= 32) Init1(); else { ++nbits; Init2(); } auto& coderev = (n <= 32 ? coderev1 : coderev2); for (int i = 0; i < l; ++i) got[x[i] & ((1U << nbits) - 1)].insert(x[i] >> nbits); for (int i = 0; i < n; ++i) { cerr << coderev[got[i]] << ' '; output(coderev[got[i]]); } for (int i = 0; i < 256; ++i) got[i].clear(); }

Compilation message (stderr)

encoder.cpp:1:10: fatal error: parrots.h: No such file or directory
 #include "parrots.h"
          ^~~~~~~~~~~
compilation terminated.

/tmp/ccC9SfxD.o: In function `main':
grader_decoder.cpp:(.text.startup+0x1f6): undefined reference to `decode(int, int, int*)'
collect2: error: ld returned 1 exit status