# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549109 | LucaDantas | Broken Device (JOI17_broken_device) | C++17 | 36 ms | 2472 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"
#include <bits/stdc++.h>
void Anna( int N, long long X, int K, int P[] ){
int p[K+1];
for(int i = 0; i < K; i++)
p[i] = P[i];
p[K] = N;
std::vector<int> valor;
while(X)
valor.push_back(X % 2), X >>= 1;
while(valor.size() % 2)
valor.push_back(0);
int id = 0, ptr = 0;
for(int i = 0; i < N; i++) {
if(p[id] < i) ++id;
if(p[id] - i >= 3 && valor.size()) {
Set(i, 1);
for(int j = 1; j < 3; j++)
Set(i+j, valor.back()), valor.pop_back();
i += 2;
} else
Set(i, 0);
}
}
#include "Brunolib.h"
#include <cstdio>
long long Bruno(int N, int A[]) {
long long ans = 0;
for(int i = 0; i < N; i++) {
if(!A[i]) continue;
for(int j = 1; j < 3; j++)
ans <<= 1, ans |= A[i+j];
i += 2;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |