# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
718817 | Hacv16 | Broken Device (JOI17_broken_device) | C++17 | 2 ms | 700 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>
using namespace std;
typedef long long ll;
void Anna(int N, ll X, int K, int P[]){
vector<bool> blocked(N);
for(int i = 0; i < K; i++){
int curBit = P[i];
blocked[curBit] = true;
}
int numFree = 0;
for(int i = 0; i < N; i++){
if(!blocked[i]){ numFree++; continue; }
if(numFree % 2) blocked[i - 1] = true;
blocked[i] = true; numFree = 0;
}
vector<int> goodPos;
for(int i = 0; i < N; i++){
if(blocked[i]) Set(i, 0);
else goodPos.push_back(i);
}
for(int i = 0, j = 0; i < goodPos.size(); i += 2, j++){
int pos1 = goodPos[i], pos2 = goodPos[i + 1];
Set(pos1, 1); Set(pos2, (bool)((1 << j) & X));
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
typedef long long ll;
ll Bruno(int N, int A[]){
ll ans = 0;
for(int i = 0, j = 0; i < N; i += 2){
if(A[i] == 0) continue;
ans |= (A[i + 1] << j); j++;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |