Submission #503910

#TimeUsernameProblemLanguageResultExecution timeMemory
503910t12345Parrots (IOI11_parrots)C++14
98 / 100
12 ms1332 KiB
#include "encoder.h" #include "encoderlib.h" #include <vector> using namespace std; void encode(int N, int M[]) { int i, j, t; vector<int> c0, c1; for(i=0; i<N; i++) { t = M[i]; for(j=0; j<(t>>6&3); j++) c0.push_back(i*4); for(j=0; j<(t>>4&3); j++) c0.push_back(i*4+1); for(j=0; j<(t>>2&3); j++) c0.push_back(i*4+2); for(j=0; j<(t>>0&3); j++) c0.push_back(i*4+3); for(j=0; j<3-(t>>6&3); j++) c1.push_back(i*4); for(j=0; j<3-(t>>4&3); j++) c1.push_back(i*4+1); for(j=0; j<3-(t>>2&3); j++) c1.push_back(i*4+2); for(j=0; j<3-(t>>0&3); j++) c1.push_back(i*4+3); } if(c0.size() < c1.size()) { for(i=0; i<c0.size(); i++) send(c0[i]); } else { for(i=0; i<c1.size(); i++) send(c1[i]); for(i=0; i<4; i++) send(0); } }
#include "decoder.h" #include "decoderlib.h" void decode(int N, int L, int X[]) { int i, c[260]={}; for(i=0; i<L; i++) c[X[i]]++; if(c[0]<4) { for(i=0; i<N; i++) { output(c[i*4]*64 + c[i*4+1]*16 + c[i*4+2]*4 + c[i*4+3]); } } else { c[0] -= 4; for(i=0; i<N; i++) { output((3-c[i*4])*64 + (3-c[i*4+1])*16 + (3-c[i*4+2])*4 + (3-c[i*4+3])); } } }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:21:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   for(i=0; i<c0.size(); i++) send(c0[i]);
      |            ~^~~~~~~~~~
encoder.cpp:23:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for(i=0; i<c1.size(); i++) send(c1[i]);
      |            ~^~~~~~~~~~
#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...