Submission #60987

#TimeUsernameProblemLanguageResultExecution timeMemory
60987khsoo01Broken Device (JOI17_broken_device)C++11
100 / 100
95 ms3744 KiB
#include "Annalib.h" const int A[8] = {6, 7, 4, 3, 1, 2, 5, 0}; const int B[8] = {3, 2, 1, 0, 1, 0, 0, 0}; const int C[8] = {2, 2, 2, 2, 1, 1, 1, 0}; int chk[155]; void Anna (int N, long long X, int K, int P[]) { for(int i=0;i<N;i++) { chk[i] = 0; } for(int i=0;i<K;i++) { chk[P[i]] = 1; } for(int i=0;i<50;i++) { int T = chk[3*i] * 1 + chk[3*i+1] * 2 + chk[3*i+2] * 4; for(int j=0;j<8;j++) { if((T & A[j]) || X % (1<<C[j]) != B[j]) continue; for(int k=0;k<3;k++) { Set(3*i+k, !!(A[j]&(1<<k))); } X /= (1<<C[j]); break; } } }
#include "Brunolib.h" const int A[8] = {6, 7, 4, 3, 1, 2, 5, 0}; const int B[8] = {3, 2, 1, 0, 1, 0, 0, 0}; const int C[8] = {2, 2, 2, 2, 1, 1, 1, 0}; long long Bruno (int N, int P[]) { long long ret = 0, bit = 1; for(int i=0;i<50;i++) { int T = P[3*i] * 1 + P[3*i+1] * 2 + P[3*i+2] * 4; for(int j=0;j<8;j++) { if(T != A[j]) continue; ret += bit * B[j]; bit *= (1<<C[j]); break; } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...