# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
71117 | yogahmad | 앵무새 (IOI11_parrots) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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]);
}