Submission #1244293

#TimeUsernameProblemLanguageResultExecution timeMemory
1244293tamyteParrots (IOI11_parrots)C++17
81 / 100
3 ms840 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void dbg(int n) { for (int i = 0; i < 8; ++i) { cout << (n >> i & 1); } cout << endl; } void encode(int N, int M[]) { for (int i = 0; i < N; ++i) { int msg = 0; for (int j = 0; j < 5; ++j) { if (i >> j & 1) { msg += 1 << j; } } for (int j = 0; j < 8; ++j) { int now = msg; for (int k = 0; k < 3; ++k) { if (j >> k & 1) { now += (1 << (k + 5)); } } if ((M[i] >> j & 1) == 1) { send(now); // dbg(now); } } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { vector<int> res(N); for (int i = 0; i < L; ++i) { int index = 0; for (int j = 0; j < 5; ++j) { if (X[i] >> j & 1) { index += (1 << j); } } int bit = 0; for (int j = 5; j < 8; ++j) { if (X[i] >> j & 1) { bit += (1 << (j - 5)); } } int state = 1; res[index] += state * (1 << bit); } for (int i = 0; i < N; ++i) { output(res[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...