Submission #23151

#TimeUsernameProblemLanguageResultExecution timeMemory
23151kdh9949Broken Device (JOI17_broken_device)C++14
0 / 100
56 ms2836 KiB
#include "Annalib.h" void send(int x, int y){ for(int t = 0; t < 3; t++, y /= 2) Set(x + 2 - t, y & 1); } void Anna(int N, long long X, int K, int P[]){ int c[150] = {}; for(int i = 0; i < K; i++) c[P[i]] = 1; int x[65] = {}, cnt = 0; for(int i = 0; i < 60; i++) x[i] = !!(X & (1LL << i)); auto b = [](const int &x){ return __builtin_popcount(x); }; for(int i = 0; i < 150; i += 3){ int q = c[i] * 4 + c[i + 1] * 2 + c[i + 2]; if(b(q) == 0){ if(x[cnt]) send(i, 3 + 4 * x[cnt + 1]); else send(i, 4 + x[cnt + 1]); cnt += 2; } else if(b(q) == 1){ if(q == 2){ if(x[cnt]){ send(i, 1); cnt++; } else{ if(x[cnt + 1]) send(i, 5); else send(i, 4); cnt += 2; } } else{ if(x[cnt]) send(i, q == 1 ? 6 : 1); else send(i, 2); cnt++; } } else send(i, 0); if(cnt >= 60) cnt = 60; } }
#include "Brunolib.h" #include <cstdio> static int v[8][2] = {{0, 0}, {1, 0}, {0, 0}, {1, 0}, {0, 0}, {0, 1}, {1, 0}, {1, 1}}; static int c[8] = {0, 1, 1, 2, 2, 2, 1, 2}, cnt; long long Bruno( int N, int A[] ){ long long X = 0; for(int i = 0; i < 150; i += 3){ int t = A[i] * 4 + A[i + 1] * 2 + A[i + 2]; for(int j = 0; j < c[t]; j++){ X += (long long)v[t][j] << (cnt + j); } cnt += c[t]; } return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...