제출 #1046527

#제출 시각아이디문제언어결과실행 시간메모리
1046527oscar1f앵무새 (IOI11_parrots)C++17
0 / 100
1 ms1316 KiB
#include<bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" using namespace std; void encode(int N, int M[]) { vector<int> listeAjout,listeRetrait; int nbVal=N,NB_BITS=8; int val; for (int i=0;i<nbVal;i++) { val=M[i]; if (i<32) { for (int j=0;j<NB_BITS;j++) { if (val%2==0) { listeRetrait.push_back(i*NB_BITS+j); } else { listeAjout.push_back(i*NB_BITS+j); } val/=2; } } else { for (int j=0;j<NB_BITS;j++) { if (val%2==0) { listeRetrait.push_back((i-32)*NB_BITS+j); listeRetrait.push_back((i-32)*NB_BITS+j); } else { listeAjout.push_back((i-32)*NB_BITS+j); listeAjout.push_back((i-32)*NB_BITS+j); } val/=2; } } } if ((int)listeAjout.size()<=(int)listeRetrait.size()+4 or 1==0) { for (int i:listeAjout) { send(i); } } else { for (int i:listeRetrait) { send(i); } for (int i=0;i<4;i++) { send(0); } } }
#include<bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; const int TAILLE_MAX=256; int nbOccu[TAILLE_MAX]; int rep[TAILLE_MAX]; void decode(int N, int L, int X[]) { for (int i=0;i<TAILLE_MAX;i++) { rep[0]=0; nbOccu[0]=0; } int nbVal=N,nbCode=L,NB_BITS=8; for (int i=0;i<nbCode;i++) { nbOccu[X[i]]++; } if (nbOccu[0]<=3) { for (int i=0;i<TAILLE_MAX;i++) { if (nbOccu[i]%2==1) { rep[i/NB_BITS]+=(1<<(i%NB_BITS)); } if (nbOccu[i]/2==1) { rep[i/NB_BITS+32]+=(1<<(i%NB_BITS)); } } for (int i=0;i<nbVal;i++) { output(rep[i]); } } else { nbOccu[0]-=4; for (int i=0;i<TAILLE_MAX;i++) { if (nbOccu[i]%2==1) { rep[i/NB_BITS]+=(1<<(i%NB_BITS)); } if (nbOccu[i]/2==1) { rep[i/NB_BITS+32]+=(1<<(i%NB_BITS)); } } for (int i=0;i<nbVal;i++) { output(TAILLE_MAX-1-rep[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...