제출 #295686

#제출 시각아이디문제언어결과실행 시간메모리
295686b00n0rp앵무새 (IOI11_parrots)C++17
17 / 100
6 ms1792 KiB
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> using namespace std; #define REP(i,n) for(int i = 0; i < n; i ++) #define FOR(i,a,b) for(int i = a; i < b; i ++) #define vi vector<int> #define pb push_back void encode(int N, int M[]){ int n = N; int a[105]; REP(i,n) a[i] = M[i]; vi v1,v2; REP(i,n){ int times = 1; if(i >= 32) times++; int cur = (i%32)*8; REP(j,8){ if(a[i]&(1<<j)){ REP(k,times){ v1.pb(cur+j); } } else{ REP(k,times){ v2.pb(cur+j); } } } } if(v1.size() < v2.size()+4){ for(auto x:v1) send(x); } else{ send(0); send(0); send(0); send(0); for(auto x:v2) send(x); } }
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> using namespace std; #define REP(i,n) for(int i = 0; i < n; i ++) #define FOR(i,a,b) for(int i = a; i < b; i ++) #define F first #define S second void decode(int N, int L, int X[]){ int ans[105]; REP(i,N) ans[i] = 0; map<int,int> m; REP(i,L) m[X[i]]++; bool flag = 0; if(m[0] >= 4){ flag = 1; m[0] -= 4; } for(auto x:m){ int ind = x.F/8; if(x.S&2) ans[ind+32] += (1<<(x.F%8)); if(x.S&1) ans[ind] += (1<<(x.F%8)); } if(!flag){ REP(i,N) output(ans[i]); } else{ REP(i,N) output(256-ans[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...