제출 #764725

#제출 시각아이디문제언어결과실행 시간메모리
764725ngrace앵무새 (IOI11_parrots)C++14
17 / 100
6 ms1224 KiB
#include "encoder.h" #include "encoderlib.h" #include <vector> #include <iostream> using namespace std; #define v vector void encode(int N, int M[]) { v<int> mess1, mess2 = {255,255,255,255}; for(int i=0; i<N; i++){ for(int j=0; j<4; j++){ int pos=4*i+j; int bit = 2*j; bool bit1 = M[i] & (1<<bit); bit++; bool bit2 = M[i] & (1<<bit); int num= bit1+2*bit2; //cout<<M[i]<<" "<<pos<<" "<<num<<endl; for(int i=0; i<num; i++) mess1.push_back(pos); for(int i=0; i<3-num; i++) mess2.push_back(pos); } } if(mess1.size()<mess2.size()){ for(int i:mess1) send(i); } else{ for(int i:mess2) send(i); } }
#include "decoder.h" #include "decoderlib.h" #include <vector> #include <iostream> using namespace std; #define v vector void decode(int N, int L, int X[]) { v<int> m(256, 0); for(int i=0; i<L; i++) m[X[i]]++; bool invert = (m[255]>=4); if(invert) m[255]-=4; for(int i=0; i<N; i++){ int out=0; for(int j=0; j<4; j++){ int num=m[4*i+j]; if(num==1 || num==3) out |= 1<<(2*j); if(num==2 || num==3) out |= 1<<(2*j+1); } //cout<<out<<endl; if(invert) out = ~out; output(out); } }
#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...