제출 #1051909

#제출 시각아이디문제언어결과실행 시간메모리
1051909Zbyszek99앵무새 (IOI11_parrots)C++17
81 / 100
3 ms1436 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = a; i <= b; i++) void encode(int n, int M[]) { vector<int> m; rep(i,0,n-1) m.push_back(M[i]); if(n > 32) { rep(j,0,(n%4)-1) m.push_back(255); for(int i = 0; i < (n+3)/4; i++) { int w = 0; int poz = i*4; if(m[poz] == 255) w += 1; if(m[poz+1] == 255) w += 2; if(m[poz+2] == 255) w += 4; if(m[poz+3] == 255) w += 8; int ans = i + (w << 4); send(ans); send(ans); send(ans); send(ans); } rep(i,0,n/2-1) { if(m[i] == 255) { continue; } rep(bit,0,7) { if(m[i] & (1 << bit)) { send(bit + (i << 3)); } } } rep(i,n/2,n-1) { if(m[i] == 255) { continue; } rep(bit,0,7) { if(m[i] & (1 << bit)) { send(bit + ((i%(n/2-1)) << 3)); send(bit + ((i%(n/2-1)) << 3)); } } } return; } rep(i,0,n-1) { rep(bit,0,7) { if(m[i] & (1 << bit)) { send(bit + (i << 3)); } } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = a; i <= b; i++) void decode(int n, int l, int x[]) { vector<int> ans(n+4,0); if(n <= 32) { rep(i,0,l-1) { int bit = 0; if(x[i] & 1) bit += 1; if(x[i] & 2) bit += 2; if(x[i] & 4) bit += 4; int poz = x[i] >> 3; ans[poz] |= (1 << bit); } } else { map<int,int> zlicz; rep(i,0,l-1) zlicz[x[i]]++; rep(i,0,l-1) { if(zlicz[x[i]] == 1 || zlicz[x[i]] == 3) { int bit = 0; if(x[i] & 1) bit += 1; if(x[i] & 2) bit += 2; if(x[i] & 4) bit += 4; int poz = x[i] >> 3; ans[poz] |= (1 << bit); } if(zlicz[x[i]] == 3) { int bit = 0; if(x[i] & 1) bit += 1; if(x[i] & 2) bit += 2; if(x[i] & 4) bit += 4; int poz = x[i] >> 3; ans[poz + n/2-1] |= (1 << bit); } if(zlicz[x[i]] == 4) { int blok = x[i] & (1+2+4+8); int is = x[i] & (16+32+64+128); int p = 0; rep(j,blok*4,blok*4+3) { if(is & (1 << p)) ans[j] = 255; p++; } } } } rep(i,0,n-1) output(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...