제출 #920823

#제출 시각아이디문제언어결과실행 시간메모리
920823Pannda앵무새 (IOI11_parrots)C++17
97 / 100
9 ms1384 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int n, int _a[]) { vector<int> a(_a, _a + n); for (int b = 0; b < 8; b++) { int cur = 0; for (int i = 0; i < n; i++) { if ((a[i] >> b & 1) != cur) { cur ^= 1; if (b < 4) { send(b + 4 * i); } else { send(b - 4 + 4 * i); send(b - 4 + 4 * i); } } } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int n, int k, int _a[]) { vector<int> a(_a, _a + k); vector<int> freq(256, 0); for (int x : a) { freq[x]++; } vector<vector<int>> change(8, vector<int>(n, 0)); for (int x = 0; x < 256; x++) { if (freq[x] & 1) { change[x % 4][x / 4] = 1; } if (freq[x] >> 1 & 1) { change[x % 4 + 4][x / 4] = 1; } } vector<int> res(n, 0); for (int b = 0; b < 8; b++) { int cur = 0; for (int i = 0; i < n; i++) { cur ^= change[b][i]; res[i] += cur << b; } } for (int x : res) { output(x); } }
#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...