Submission #899917

#TimeUsernameProblemLanguageResultExecution timeMemory
899917ar88loParrots (IOI11_parrots)C++14
Compilation error
0 ms0 KiB
//#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]){ int ind = 0; for(int i = N-1; i >= 0; i--){ for(int j = 0; j < 8; j++){ if((M[i] >> j) & 1){ send(ind); //cout<<ind<<"kh\n"; } ind++; } } }
//#include "decoder.h" #include "decoderlib.h" //#include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]){ int a[8192]; memset(a, 0, sizeof a); for(int i = 0; i < L; i++){ int ind = X[i]; a[ind] = 1; } int cur = 0; int cnt = 0; vector<int> ret; for(int i = 0; i < 8192; i++){ if(a[i] == 1){ //cout<<i<<" "<<cnt<<'\n'; cur = (cur | (1<<cnt)); } cnt++; if(cnt == 8){ //cout<<cur<<"kh2\n"; ret.push_back(cur); cnt = 0; cur = 0; } if(ret.size() == N) break; } reverse(ret.begin(), ret.end()); for(int i = 0; i < N; i++){ output(ret[i]); } }

Compilation message (stderr)

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:9:2: error: 'memset' was not declared in this scope
    9 |  memset(a, 0, sizeof a);
      |  ^~~~~~
decoder.cpp:3:1: note: 'memset' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    2 | #include "decoderlib.h"
  +++ |+#include <cstring>
    3 | //#include <bits/stdc++.h>
decoder.cpp:16:2: error: 'vector' was not declared in this scope
   16 |  vector<int> ret;
      |  ^~~~~~
decoder.cpp:3:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    2 | #include "decoderlib.h"
  +++ |+#include <vector>
    3 | //#include <bits/stdc++.h>
decoder.cpp:16:9: error: expected primary-expression before 'int'
   16 |  vector<int> ret;
      |         ^~~
decoder.cpp:25:4: error: 'ret' was not declared in this scope
   25 |    ret.push_back(cur);
      |    ^~~
decoder.cpp:29:6: error: 'ret' was not declared in this scope
   29 |   if(ret.size() == N) break;
      |      ^~~
decoder.cpp:31:10: error: 'ret' was not declared in this scope
   31 |  reverse(ret.begin(), ret.end());
      |          ^~~
decoder.cpp:31:2: error: 'reverse' was not declared in this scope
   31 |  reverse(ret.begin(), ret.end());
      |  ^~~~~~~