# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
754119 | piOOE | Broken Device (JOI17_broken_device) | C++17 | 39 ms | 2440 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
void Anna(int N, long long x, int K, int P[]) {
int used[150]{};
for (int i = 0; i < K; ++i) {
used[P[i]] = true;
}
for (int i = N - 3; i >= 0; i -= 3) {
int a = 0, b = 0, c = 0;
if (used[i] + used[i + 1] + used[i + 2] == 0) {
if (x % 4 == 0) {
b = 1;
} else if (x % 4 == 1) {
a = c = 1;
} else if (x % 4 == 2) {
a = b = 1;
} else {
a = b = c = 1;
}
x /= 4;
} else if (used[i] + used[i + 1] + used[i + 2] == 1) {
if (x % 2 == 0) {
if (!used[i + 2]) {
c = 1;
} else {
a = bool(x % 4), b = 1;
x /= 2;
}
} else if (used[i]) {
b = c = 1;
} else {
a = 1;
}
x /= 2;
}
Set(i, a), Set(i + 1, b), Set(i + 2, c);
}
}
#include "Brunolib.h"
long long Bruno(int N, int A[]) {
long long x = 0;
for (int i = 0; i < N; i += 3) {
int d = A[i] * 4 + A[i + 1] * 2 + A[i + 2];
if (d == 1) {
x = x * 2;
} else if (d == 2) {
x = x * 4;
} else if (d == 3 || d == 4) {
x = x * 2 + 1;
} else if (d == 5) {
x = x * 4 + 1;
} else if (d == 6) {
x = x * 4 + 2;
} else if (d == 7) {
x = x * 4 + 3;
}
}
return x;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |