# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23152 | kdh9949 | Broken Device (JOI17_broken_device) | C++14 | 46 ms | 2836 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |