Submission #583560

#TimeUsernameProblemLanguageResultExecution timeMemory
583560benson1029Parrots (IOI11_parrots)C++14
99 / 100
132 ms13808 KiB
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> using namespace std; namespace encoder_var { int faken; int a[1005]; vector< vector<int> > v; void perm(vector<int> x, int curr) { if(v.size()==65536) return; if(x.size()==12) { v.push_back({}); for(int i:x) { if(i!=-1) v[v.size()-1].push_back(i); } return; } for(int i=curr; i<8; i++) { x.push_back(i); perm(x, i); x.pop_back(); } } }; void encode(int N, int M[]) { using namespace encoder_var; perm({}, -1); for(int i=0; i<N; i+=2) { int value; if(i==N-1) { value = M[i]; } else { value = M[i] + M[i+1] * 256; } int init = i/2*8; for(int j=0; j<v[value].size(); j++) { send(v[value][j]+init); } } }
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> using namespace std; namespace decoder_var { int faken; int a[1005]; vector< vector<int> > v; vector<int> tmp; void perm(vector<int> x, int curr) { if(v.size()==65536) return; if(x.size()==12) { v.push_back({}); for(int i:x) { if(i!=-1) v[v.size()-1].push_back(i); } return; } for(int i=curr; i<8; i++) { x.push_back(i); perm(x, i); x.pop_back(); } } }; void decode(int N, int L, int X[]) { using namespace decoder_var; sort(X, X+L); int ptr = 0; perm({}, -1); for(int i=0; i<64; i+=2) { int init = i/2*8; tmp.clear(); while(ptr<L && X[ptr]<init+8) { tmp.push_back(X[ptr]-init); ++ptr; } for(int j=0; j<v.size(); j++) { if(v[j] == tmp) { a[i+1] = j/256; a[i] = j%256; break; } } } for(int i=0; i<N; i++) output(a[i]); }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:40:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |   for(int j=0; j<v[value].size(); j++) {
      |                ~^~~~~~~~~~~~~~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:42:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |   for(int j=0; j<v.size(); j++) {
      |                ~^~~~~~~~~
#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...