Submission #899923

#TimeUsernameProblemLanguageResultExecution timeMemory
899923ar88loParrots (IOI11_parrots)C++14
81 / 100
3 ms1336 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:29:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |   if(ret.size() == N) break;
      |      ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...