Submission #24731

#TimeUsernameProblemLanguageResultExecution timeMemory
24731mohammad_kilaniParrots (IOI11_parrots)C++14
17 / 100
4 ms1576 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { int n = 8; for(int i=0;i<N;i++){ int num = M[i] ; int idx = i*n; int all = 0; for(int j=0;j<3;j++){ int cur = ((num >> j) & 1); all |= (cur << j); } idx+=all; num = (num >> 3); for(int j=0;j<=num;j++) send(idx); } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { int n = 8; vector<int> mul(N); vector<int> frq(N); for(int i=0;i<L;i++){ int cur = X[i]; int idx = cur / n ; int b = cur % n; mul[idx] = b; frq[idx]++; } for(int i=0;i<N;i++){ frq[i]--; frq[i] = (frq[i] << 3); mul[i]+=frq[i]; int ans = mul[i]; output(ans); } }
#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...