Submission #881639

#TimeUsernameProblemLanguageResultExecution timeMemory
881639karriganParrots (IOI11_parrots)C++14
0 / 100
1 ms1316 KiB
#include<bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" using namespace std; #define all(fl) fl.begin(),fl.end() #define pb push_back #define fi first #define se second #define for1(i,j,k) for(int i=j;i<=k;i++) #define for2(i,j,k) for(int i=j;i>=k;i--) #define for3(i,j,k,l) for(int i=j;i<=k;i+=l) #define lb lower_bound #define ub upper_bound #define sz(a) (int)a.size() #define pii pair<int,int> #define pli pair<long long,int> #define gcd __gcd #define lcm(x,y) x*y/__gcd(x,y) //chia thanh 4 bit danh so vi tri 2 bit de danh so nhom 2 bit danh so value int a[8]; int mul[4]={(1<<6),(1<<4),(1<<2),(1<<0)}; void encode(int n,int M[]){ for1(i,0,n-1){ int value=M[i]; int pos=(i)*(1<<4); for1(j,0,7){ a[j]=(value>>j&1); } //0 1 to group 3, 2 3 to group 2, 4 5 to group 1, 6 7 to group 0 reverse(a,a+8); int cnt=0; for(int j=0;j<=7;j+=2){ int nval=a[j]*2+a[j+1]; int last4bit=(cnt*(1<<2)+nval); send(pos+last4bit); cnt++; } } } /*signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); //freopen("temp.INP","r",stdin); //freopen("temp.OUT","w",stdout); encode(3,{10,30,20}); }*/
#include<bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; #define all(fl) fl.begin(),fl.end() #define pb push_back #define fi first #define se second #define for1(i,j,k) for(int i=j;i<=k;i++) #define for2(i,j,k) for(int i=j;i>=k;i--) #define for3(i,j,k,l) for(int i=j;i<=k;i+=l) #define lb lower_bound #define ub upper_bound #define sz(a) (int)a.size() #define pii pair<int,int> #define pli pair<long long,int> #define gcd __gcd #define lcm(x,y) x*y/__gcd(x,y) //chia thanh 4 bit danh so vi tri 2 bit de danh so nhom 2 bit danh so value int mul[4]={(1<<6),(1<<4),(1<<2),(1<<0)}; int b[16]; void decode(int n,int l,int x[]){ for1(i,0,l-1){ int vl=x[i]; int pos=(vl>>4); int last4bit=vl%(1<<4); int group=(last4bit>>2); int valuegr=(last4bit%(1<<2)); b[pos]+=valuegr*mul[group]; } for1(i,0,n-1)output(b[i]); } /*signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); //freopen("temp.INP","r",stdin); //freopen("temp.OUT","w",stdout); encode(3,{10,30,20}); }*/
#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...