# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
71117 | yogahmad | Parrots (IOI11_parrots) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "encoder.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fbo find_by_order
#define ook order_of_key
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define MOD 1000000007
#define MID (l+r)/2
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define mx 100003
#define pc(x) putchar_unlocked(x);
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void encode(int N, int M[]){
//5 bit pertama posisi
for(int i=0;i<N;i++){
int pos=i*8;
int now=M[i];
for(int j=2;j<=4;j++){
int sem=now%8;
for(int k=0;k<j;k++){
send(pos+sem);
}
now/=8;
}
}
}
#include "decoder.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fbo find_by_order
#define ook order_of_key
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define MOD 1000000007
#define MID (l+r)/2
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define mx 100003
#define pc(x) putchar_unlocked(x);
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int cnt[mx],jaw[mx];
void decode(int N, int L, int X[]){
reset(cnt,0);
reset(jaw,0);
set<int>ini;
for(int i=0;i<L;i++)ini.insert(X[i]),cnt[X[i]]++;
for(int i:ini){
int pos=i/8;
if(cnt[i]==2){
jaw[pos]+=i%8;
}
else if(cnt[i]==3){
jaw[pos]+=(i%8)*8;
}
else if(cnt[i]==4){
jaw[pos]+=(i%8)*64;
}
else if(cnt[i]==5){
jaw[pos]+=(i%8)*8;
jaw[pos]+=i%8;
}
else if(cnt[i]==6){
jaw[pos]+=i%8;
jaw[pos]+=(i%8)*64;
}
else if(cnt[i]==7){
jaw[pos]+=(i%8)*8;
jaw[pos]+=(i%8)*64;
}
else if(cnt[i]==9){
jaw[pos]+=i%8;
jaw[pos]+=(i%8)*8;
jaw[pos]+=(i%8)*64;
}
else assert(false);
}
for(int i=0;i<N;i++)output(jaw[i]);
}