# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
24099 | jiaqiyang | Broken Device (JOI17_broken_device) | C++14 | 55 ms | 2836 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <cstdio>
#include <cstring>
typedef long long i64;
static bool ans[200];
inline void append(int x, bool a, bool b, bool c) {
ans[x] = a;
ans[x + 1] = b;
ans[x + 2] = c;
}
void Anna(int n, i64 x, int k, int p[]) {
static bool flag[200];
memset(flag, 0, sizeof flag);
for (int i = 0; i < k; ++i) flag[p[i]] = true;
memset(ans, 0, sizeof ans);
for (int i = 0; i < n; i += 3) {
int cnt = flag[i] + flag[i + 1] + flag[i + 2];
if (cnt > 1) continue;
if (flag[i]) {
if (x & 1) append(i, 0, 1, 0); else append(i, 0, 0, 1);
x >>= 1;
} else if (flag[i + 1]) {
if (x & 1) append(i, 1, 0, 1); else append(i, 0, 0, 1);
x >>= 1;
} else if (flag[i + 2]) {
if (x & 1) {
append(i, 0, 1, 0);
x >>= 1;
} else if (x & 2) {
append(i, 1, 0, 0);
x >>= 2;
} else {
append(i, 1, 1, 0);
x >>= 2;
}
} else {
switch (x & 3) {
case 0: append(i, 1, 1, 0); break;
case 1: append(i, 0, 1, 1); break;
case 2: append(i, 1, 0, 0); break;
case 3: append(i, 1, 1, 1); break;
}
x >>= 2;
}
}
for (int i = 0; i < n; ++i) Set(i, ans[i] && !flag[i]);
}
#include "Brunolib.h"
typedef long long i64;
i64 Bruno(int n, int a[]) {
i64 res = 0, base = 1;
for (int i = 0; i < n; i += 3) {
int cur = a[i] | (a[i + 1] << 1) | (a[i + 2] << 2);
switch (cur) {
case 4:
base <<= 1;
break;
case 2:
case 5:
res += base;
base <<= 1;
break;
case 3:
base <<= 2;
break;
case 6:
res += base;
base <<= 2;
break;
case 1:
res += 2 * base;
base <<= 2;
break;
case 7:
res += 3 * base;
base <<= 2;
break;
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |