# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123049 | tjd229 | Broken Device (JOI17_broken_device) | C++14 | 43 ms | 3064 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 Anna(int N, long long X, int K, int P[]) {
int mem[150];
for (int i = 0; i < N; ++i) mem[i] = -1;
for (int i = 0; i < K; ++i) mem[P[i]] = 0;
for (int pos = 0; X && pos + 1 < N; ++pos) {
if (mem[pos] == 0 && mem[pos + 1] == 0) continue;
else if (mem[pos] == 0 && mem[pos + 1]==-1) {//01
if (X & 1) {
mem[pos + 1] = 1;
X >>= 1;
}
}
else if (mem[pos] == -1 && mem[pos + 1] == -1) {//00->1X
mem[pos] = 1;
mem[++pos] = X & 1;
X >>= 1;
}
else if (mem[pos] == 1 && mem[pos + 1] == -1) {//10->1X
mem[pos] = 1;
mem[++pos] = X & 1;
X >>= 1;
}
}
for (int i = 0; i < N; ++i) Set(i, mem[i] < 0 ? 0 : mem[i]);
//for (int i = 0; i < 10; ++i) printf("%d ",mem[i]);
}
#include "Brunolib.h"
long long Bruno( int N, int A[] ){
long long X = 0;
int recon[60] = { 0 };
int pos = 0;
for (int i = 0; i + 1 < N && pos<60; ++i) {
int b2 = A[i] + A[i] + A[i + 1];
if (b2&1) recon[pos++] = 1;
else if (b2 & 2) recon[pos++] = 0;
if (b2 & 2) ++i;
}pos = 60;
while (pos--) {
X <<= 1;
X += recon[pos];
}
return X;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |