제출 #628185

#제출 시각아이디문제언어결과실행 시간메모리
628185abcvuitunggio앵무새 (IOI11_parrots)C++17
0 / 100
7 ms1232 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]){ vector <int> v,v2; for (int i=0;i<N;i++){ for (int j=0,k=1;j<4;j++,k*=4){ int x=M[i]/k%4; for (int l=0;l<x;l++) v.push_back(i*4+j); for (int l=0;l<3-x;l++) v2.push_back(i*4+j); } } if (v.size()<v2.size()) for (int i:v) send(i); else{ for (int i:v2) send(i); for (int j=0;j<4;j++) send(0); } }
#include "decoder.h" #include "decoderlib.h" #include <algorithm> using namespace std; int pw(int a, int b){ int res=1; for (int i=0;i<b;i++) res*=a; return res; } void decode(int N, int L, int X[]){ sort(X,X+L); int mode=1,res[N]; for (int i=0;i<N;i++) res[i]=0; if (X[0]==X[1]&&X[1]==X[2]&&X[2]==X[3]&&!X[0]) mode=0; for (int i=(mode?0:4);i<L;i++) res[X[i]/4]+=pw(4,X[i]%4); for (int i=0;i<N;i++) output((mode?res[i]:255-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...