Submission #347512

#TimeUsernameProblemLanguageResultExecution timeMemory
347512daniel920712Parrots (IOI11_parrots)C++14
98 / 100
10 ms1532 KiB
#include "encoder.h" #include "encoderlib.h" #include <vector> #include <algorithm> using namespace std; void encode(int N, int M[]) { vector < int > a,b; vector < int > all; int i,j,now=0,x=0,y=0,K; b.push_back(0); b.push_back(0); b.push_back(0); b.push_back(0); for(i=0;i<N;i++) for(j=7;j>=0;j--) all.push_back(M[i]&(1<<j)); K=all.size(); for(i=0;i<K;i++) { if(all[i]) for(j=0;j<1<<(i/256);j++) a.push_back(i%256); else for(j=0;j<1<<(i/256);j++) b.push_back(i%256); } if(a.size()<b.size()) for(auto i:a) send(i); else for(auto i:b) send(i); }
#include "decoder.h" #include "decoderlib.h" #include <map> #include <vector> #include <utility> #include <algorithm> using namespace std; void decode(int N, int L, int X[]) { vector < int > all; map < int , int > con; int ans[605]; int i,j,ok=0,tt; for(i=0; i<L; i++) con[X[i]]++; for(auto i:con) if(i.second&4) ok=1; for(i=0;i<8*N;i++) ans[i]=ok; for(auto i:con) { if(i.second&2) ans[i.first+256]=1-ok; if(i.second&1) ans[i.first]=1-ok; } for(i=0;i<N;i++) { tt=0; for(j=0;j<8;j++) tt+=(1<<(7-j))*ans[8*i+j]; //printf("%d\n",tt); output(tt); } }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:12:10: warning: unused variable 'now' [-Wunused-variable]
   12 |  int i,j,now=0,x=0,y=0,K;
      |          ^~~
encoder.cpp:12:16: warning: unused variable 'x' [-Wunused-variable]
   12 |  int i,j,now=0,x=0,y=0,K;
      |                ^
encoder.cpp:12:20: warning: unused variable 'y' [-Wunused-variable]
   12 |  int i,j,now=0,x=0,y=0,K;
      |                    ^
#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...