# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100066 | shenxy | Broken Device (JOI17_broken_device) | C++11 | 76 ms | 3328 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 <algorithm>
#include <deque>
#include <unordered_set>
using namespace std;
void Anna(int N, long long X, int K, int P[]) {
deque<int> mybitset;
int ptr = 0;
unordered_set<int> brokenbits;
for (int i = 0; i < K; i++) brokenbits.insert(P[i]);
while (X) {
if (brokenbits.find(ptr) != brokenbits.end() || brokenbits.find(ptr + 1) != brokenbits.end()) {
mybitset.push_back(0);
mybitset.push_back(0);
} else {
if (X % 2) {
mybitset.push_back(1);
mybitset.push_back(0);
} else {
mybitset.push_back(1);
mybitset.push_back(1);
}
}
ptr += 2;
X = X >> 1;
}
for (int i = 0; i < N; i++) {
if (i < mybitset.size()) Set(i, mybitset[i]);
else Set(i, 0);
}
}
#include "Brunolib.h"
#include <algorithm>
using namespace std;
long long Bruno(int N, int A[]) {
int ptr = N - 2;
long long int ans = 0;
while (ptr >= 0) {
int a = A[ptr], b = A[ptr + 1];
if (a == 0 && b == 0);
else if (a == 1 && b == 1) ans *= 2;
else ans = ans * 2 + 1;
ptr -= 2;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |