Submission #261208

#TimeUsernameProblemLanguageResultExecution timeMemory
261208Toirov_SadiParrots (IOI11_parrots)C++17
98 / 100
19 ms4080 KiB
#include <bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" using namespace std; vector<string> v; void rec(string s){ if((int)s.size() <= 7){ if(!s.empty()) v.push_back(s); } else return; for(auto x: {'0', '1', '2', '3'}){ if(s.empty() || x >= s.back()){ rec(s + x); } } } void encode(int N, int M[]){ rec(""); for(int i = 0; i < N; i ++){ for(auto c: v[M[i]]){ send(i + ((c - '0') << 6)); } } }
#include <bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; vector<string> v; void rec(string s){ if((int)s.size() <= 7){ if(!s.empty()) v.push_back(s); } else return; for(auto x: {'0', '1', '2', '3'}){ if(s.empty() || x >= s.back()){ rec(s + x); } } } void decode(int N, int L, int X[]){ rec(""); vector<string> a(256); for(int i = 0; i < L; i ++){ int pos = (X[i] & ((1 << 6) - 1)); int x = (X[i] >> 6); a[pos] += (x + '0'); } for(int i = 0; i < N; i ++){ sort(a[i].begin(), a[i].end()); for(int j = 0; j < 256; j ++){ if(a[i] == v[j]){ output(j); 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...