Submission #250514

#TimeUsernameProblemLanguageResultExecution timeMemory
250514kostia244Parrots (IOI11_parrots)C++17
Compilation error
0 ms0 KiB
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> using namespace std; void decode(int n, int l, int X[]) { vector<int> res(n); map<int, int> cnt; for(int i = 0; i < l; i++) cnt[X[i]]++; vector<int> G = {0, 1, 2, 3}; for(auto i : cnt) { if(i.second >= n) { i.second -= n; while(i.second--) next_permutation(G.begin(), G.end()); } } //for(auto i : G) cout << i << " "; cout << '\n'; for(int i = 0; i < 255; i++) { if(i/4 >= res.size()) break; if(cnt[i] >= n) cnt[i] = 0; res[i/4] += G[cnt[i]]<<(2*(i&3)); } //for(int i = 0; i < n; i++) cout << res[i] << '\n'; for(int i = 0; i < n; i++) output(res[i]); }
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> using namespace std; int ord(vector<array<int, 2>> g) { int o = 0, f = 1; for(int i = 0; i < g.size(); i++) { f = 1; for(int j = 1; j < g.size()-i; j++) f *= j; int s = 0; for(int j = i; j < g.size(); j++) s += g[j][1] < g[i][1]; o += s*f; } //for(int i = 0; i < g.size(); i++) cout << g[i][1] << " ";cout << " : " << o << '\n'; return o; } void encode(int n, int b[]) { map<int, int> m; for(int i = 0; i < n; i++) { int t = b[i], g = 0; for(int g = 0; g < 4; g++) { m[4*i + g]+=(t&3); t>>=2; } } map<int, int> ff; for(auto [x, y] : m) ff[y]++; vector<array<int, 2>> g; for(int i = 0; i < 4; i++) g.push_back(array<int, 2>{ff[i], i}); sort(g.rbegin(), g.rend()); //swap(g[0], g[1]); map<int, int> c; for(int i = 0; i < g.size(); i++) c[g[i][1]] = i; int empt = 0; for(auto [i, f] : m) { //cout << f << " to "; f = c[f]; //cout << c[f] << '\n'; if(!f) empt = i; while(f--) send(i); } for(int i = n + ord(g); i--;) send(empt); }

Compilation message (stderr)

encoder.cpp: In function 'void decode(int, int, int*)':
encoder.cpp:19:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(i/4 >= res.size()) break;
      ~~~~^~~~~~~~~~~~~
/tmp/ccgP59Bt.o: In function `main':
grader_encoder.cpp:(.text.startup+0x141): undefined reference to `encode(int, int*)'
/tmp/ccdn82ym.o: In function `decode(int, int, int*)':
encoder.cpp:(.text+0x485): undefined reference to `output(int)'
collect2: error: ld returned 1 exit status

decoder.cpp: In function 'int ord(std::vector<std::array<int, 2> >)':
decoder.cpp:7:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < g.size(); i++) {
                 ~~^~~~~~~~~~
decoder.cpp:9:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 1; j < g.size()-i; j++) f *= j;
                  ~~^~~~~~~~~~~~
decoder.cpp:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = i; j < g.size(); j++) s += g[j][1] < g[i][1];
                  ~~^~~~~~~~~~
decoder.cpp: In function 'void encode(int, int*)':
decoder.cpp:20:17: warning: unused variable 'g' [-Wunused-variable]
   int t = b[i], g = 0;
                 ^
decoder.cpp:27:16: warning: unused variable 'x' [-Wunused-variable]
  for(auto [x, y] : m) ff[y]++;
                ^
decoder.cpp:33:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < g.size(); i++) c[g[i][1]] = i;
                 ~~^~~~~~~~~~
/tmp/cccNXucQ.o: In function `main':
grader_decoder.cpp:(.text.startup+0x1f6): undefined reference to `decode(int, int, int*)'
/tmp/ccLdQcVO.o: In function `encode(int, int*)':
decoder.cpp:(.text+0xac4): undefined reference to `send(int)'
decoder.cpp:(.text+0xb4d): undefined reference to `send(int)'
collect2: error: ld returned 1 exit status