# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102635 | fanache99 | Broken Device (JOI17_broken_device) | C++14 | 67 ms | 3312 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"
const int MAXN = 150;
const int BITS = 60;
int a[MAXN];
bool bad[MAXN];
void Anna(int n, long long x, int k, int p[]){
for (int i = 0; i < n; i++) {
bad[i] = false;
a[i] = 0;
}
for (int i = 0; i < k; i++)
bad[p[i]] = true;
for (int i = BITS - 1, j = -1; i >= 0; i--) {
if (x & (1LL << i))
j += 2;
else
j++;
while (j < n && bad[j])
j += 2;
if (j < n)
a[j] = 1;
}
for (int i = 0; i < n; i++)
Set(i, a[i]);
}
#include "Brunolib.h"
long long Bruno(int n, int a[]) {
long long answer = 0;
int bit = 0;
for (int i = 0; i < n; i++) {
if (!a[i])
bit ^= 1;
else {
answer = answer * 2 + bit;
bit = 0;
}
}
return answer;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |