제출 #679355

#제출 시각아이디문제언어결과실행 시간메모리
679355Cross_Ratio앵무새 (IOI11_parrots)C++14
81 / 100
6 ms1316 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; array<int, 4> B[105]; void encode(int N, int M[]) { int i, j; B[0] = {0, 0, 0, 0}; B[1] = {0, 0, 0, 1}; B[2] = {0, 0, 0, 2}; B[3] = {0, 0, 0, 3}; B[4] = {0, 0, 1, 1}; B[5] = {0, 0, 1, 2}; B[6] = {0, 0, 1, 3}; B[7] = {0, 0, 2, 2}; B[8] = {0, 0, 2, 3}; B[9] = {0, 0, 3, 3}; B[10] = {0, 1, 1, 1}; B[11] = {0, 1, 1, 2}; B[12] = {0, 1, 1, 3}; B[13] = {0, 1, 2, 2}; B[14] = {0, 1, 2, 3}; B[15] = {0, 1, 3, 3}; for(i=0;i<N;i++) { int x = M[i] / (1<<4); for(j=0;j<4;j++) { int val = (1<<3) * i + 0 * (1<<2) + B[x][j]; send(val); } x = M[i] % (1<<4); for(j=0;j<4;j++) { int val = (1<<3) * i + 1 * (1<<2) + B[x][j]; send(val); } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; int C[256]; vector<int> V[64][2]; void decode(int N, int L, int X[]) { int i, j; C[0*64+0*16+0*4+0*1] = 0; C[0*64+0*16+0*4+1*1] = 1; C[0*64+0*16+0*4+2*1] = 2; C[0*64+0*16+0*4+3*1] = 3; C[0*64+0*16+1*4+1*1] = 4; C[0*64+0*16+1*4+2*1] = 5; C[0*64+0*16+1*4+3*1] = 6; C[0*64+0*16+2*4+2*1] = 7; C[0*64+0*16+2*4+3*1] = 8; C[0*64+0*16+3*4+3*1] = 9; C[0*64+1*16+1*4+1*1] = 10; C[0*64+1*16+1*4+2*1] = 11; C[0*64+1*16+1*4+3*1] = 12; C[0*64+1*16+2*4+2*1] = 13; C[0*64+1*16+2*4+3*1] = 14; C[0*64+1*16+3*4+3*1] = 15; assert(L==8*N); for(i=0;i<N;i++) { V[i][0].clear(); V[i][1].clear(); } for(i=0; i<L; i++) { int v = X[i]; V[v / (1<<3)][(v / (1<<2)) % 2].push_back(v % (1<<2)); } for(i=0;i<N;i++) { sort(V[i][0].begin(),V[i][0].end()); reverse(V[i][0].begin(),V[i][0].end()); int v1 = 0, cnt1 = 1; for(j=0;j<4;j++) { v1 += V[i][0][j] * cnt1; cnt1 *= 4; } int k1 = C[v1]; sort(V[i][1].begin(),V[i][1].end()); reverse(V[i][1].begin(),V[i][1].end()); int v2 = 0, cnt2 = 1; for(j=0;j<4;j++) { v2 += V[i][1][j] * cnt2; cnt2 *= 4; } int k2 = C[v2]; output(k1 * (1<<4) + k2); } }
#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...