Submission #1118489

#TimeUsernameProblemLanguageResultExecution timeMemory
1118489ortsacParrots (IOI11_parrots)C++17
81 / 100
5 ms1572 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int n, int v[]) { vector<bool> on(512); int val = -1; for (int i = 0; i < n; i++) { for (int j = 7; j >= 0; j--) { val++; if (v[i] & (1 << j)) on[val] = 1; } } for (int i = 0; i < 256; i++) { if (on[i]) send(i); if (on[i + 256]) { send(i); send(i); } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int n, int l, int x[]) { vector<int> qtd(256); for (int i = 0; i < l; i++) qtd[x[i]]++; vector<bool> tem(512); for (int i = 0; i < 256; i++) { if ((qtd[i] == 1) || (qtd[i] == 3)) tem[i] = 1; else if ((qtd[i] == 2) || (qtd[i] == 3)) tem[i + 256] = 1; } int val = -1; for (int i = 0; i < n; i++) { int curr = 0; for (int j = 7; j >= 0; j--) { val++; if (tem[val]) curr += (1 << j); } output(curr); } }
#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...