제출 #1133290

#제출 시각아이디문제언어결과실행 시간메모리
1133290StefanSebez앵무새 (IOI11_parrots)C++20
6 / 100
6 ms840 KiB
#include <bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" using namespace std; #define pb push_back void encode(int n, int a[]){ vector<int>b; for(int i=0;i<n;i++){ for(int j=7;j>=0;j--) b.pb((a[i]>>j)&1); } //for(auto i:b) printf("%i ",i);printf("\n"); vector<int>c; for(int i=0;i<b.size();i+=2){ int x=b[i+1]+2*b[i]; c.pb(x); } //for(auto i:c) printf("%i ",i);printf("\n"); int sum0=0,sum1=0; for(auto i:c) sum0+=i,sum1+=3-i; if(sum0>=sum1){ for(int i=0;i<c.size();i++){ for(int j=0;j<c[i];j++) send(i); } } else{ for(int j=0;j<3-c[0]+4;j++) send(0); for(int i=1;i<c.size();i++){ for(int j=0;j<3-c[i];j++) send(i); } } }
#include <bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; void decode(int n, int m, int a[]){ vector<int>b(n*8); /*for(int i=0;i<m;i++){ b[a[i]]=1; }*/ int num[270]={0}; for(int i=0;i<m;i++){ num[a[i]]++; } if(num[0]>3){ num[0]%=4; for(int i=0;i<256;i++) num[i]=3-num[i]; } for(int i=0;i<256;i++){ if(2*i+1>=8*n) break; if(num[i]==0) b[2*i]=b[2*i+1]=0; if(num[i]==1) b[2*i]=0,b[2*i+1]=1; if(num[i]==2) b[2*i]=1,b[2*i+1]=0; if(num[i]==3) b[2*i]=b[2*i+1]=1; } //for(auto i:b) printf("%i",i);printf("\n"); for(int i=0;i<8*n;i+=8){ int x=0; for(int j=i+7,e=1;j>=i;j--,e<<=1){ x+=e*b[j]; } //printf("%i ",x); output(x); } //printf("\n"); }
#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...