Submission #36363

#TimeUsernameProblemLanguageResultExecution timeMemory
36363funcsrParrots (IOI11_parrots)C++14
96 / 100
13 ms2544 KiB
#include <iostream> #include <vector> #include <queue> #include "encoder.h" #include "encoderlib.h" using namespace std; #define INF 1145141919 #define rep(i, n) for (int i=0; i<(n); i++) #define pb push_back #define all(x) x.begin(), x.end() #define _1 first #define _2 second typedef pair<int, int> P; const int B = 0b10101010; void encode(int N, int A[]) { if (N <= 32) { rep(i, N) rep(j, 8) if ((A[i]>>j)&1) send((i<<3) | j); } else { rep(i, N) A[i] ^= B; rep(i, N) rep(j, 4) rep(_, (A[i]>>(2*j))&0b11) send((i<<2) | j); } }
#include <iostream> #include <vector> #include <queue> #include "decoder.h" #include "decoderlib.h" using namespace std; #define INF 1145141919 #define rep(i, n) for (int i=0; i<(n); i++) #define pb push_back #define all(x) x.begin(), x.end() #define _1 first #define _2 second typedef pair<int, int> P; const int B = 0b10101010; int A[64]; int C[256]; void decode(int N, int L, int X[]) { //rep(i, N) rep(j, 4) rep(_, (A[i]>>(2*j))&0b11) send((i<<2) | j); rep(i, 256) C[i] = 0; rep(i, L) C[X[i]]++; rep(i, N) A[i] = 0; if (N <= 32) { rep(i, 256) { int j = i&0b111; int pos = i>>3; A[pos] |= C[i]<<j; } } else { rep(i, 256) { int j = i&0b11; int pos = i>>2; A[pos] |= C[i]<<(2*j); } rep(i, N) A[i] ^= B; } rep(i, N) output(A[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...