# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97741 | silxikys | Broken Device (JOI17_broken_device) | C++14 | 55 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"
#include <vector>
#include <string>
void Anna(int N, long long X, int K, int P[]) {
std::vector<int> blocked(N,-1);
std::string ans;
for (int i = 0; i < K; i++) {
blocked[P[i]] = 0;
}
int pos = 0;
for (int i = 0; i < N; i += 3) {
int cnt = (blocked[i] == 0) + (blocked[i+1] == 0) + (blocked[i+2] == 0);
if (cnt > 1 || (X >> pos) == 0) {
ans += "000";
}
else if (cnt == 1) {
if (blocked[i] == 0) {
if (!(1 & (X>>pos))) {
ans += "001";
}
else {
ans += "010";
}
pos++;
}
else if (blocked[i+1] == 0) {
if (!(1 & (X>>pos))) {
ans += "001";
pos++;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |