제출 #718035

#제출 시각아이디문제언어결과실행 시간메모리
718035Thisisadrill앵무새 (IOI11_parrots)C++14
98 / 100
10 ms1368 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int n, int A[]){ const int nn = 32; const int LOG = 8; int on = 0,zr = 0; for(int i = 0;i<n;i++){ for(int j = 0;j<LOG;j++){ if(A[i] & (1<<j))on++; else zr++; } } if(on <= zr){ for(int i = 0;i<n;i++){ for(int j = 0;j<LOG;j++){ if(A[i] & (1<<j)){ if(i < nn)send(j * nn + (i)); else { send(j * nn + (i -nn)); send(j * nn + (i -nn)); } } } } }else{ send(0); send(0); send(0); send(0); for(int i = 0;i<n;i++){ for(int j = 0;j<LOG;j++){ if(!(A[i] & (1<<j))){ if(i < nn)send(j * nn + (i)); else { send(j * nn + (i -nn)); send(j * nn + (i -nn)); } } } } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int n, int l, int A[]){ const int nn = 32; unordered_map<int,int> mp; for(int i = 0;i<l;i++){ mp[A[i]]++; } bool flip = (mp[0] > 3); if(flip)mp[0] -= 4; int res[n] = {0}; for(auto p : mp){ int a = p.first; int b = p.second; if(b == 1 || b == 3)res[a % nn] |= (1 << (a/nn)); if(b == 2 || b == 3)res[a % nn + nn] |= (1 << (a/nn)); } for(int i = 0;i<n;i++){ if(flip)res[i] = 255 - res[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...