| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 21590 | Ushio | Broken Device (JOI17_broken_device) | C++14 | 52 ms | 4636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
void Anna(int N, long long X, int K, int P[] ){
vector<int> bits(N);
for (int i = 0; i < N; ++i) {
bits[i] = i >= 60 ? 0: ((X & (1LL << i)) != 0);
}
vector<int> bad(N, 0);
for (int i = 0; i < K; ++i) {
bad[P[i]] = 1;
}
int pos = 0;
for (int i = 0; i < N; i += 3) {
int cnt = bad[i] + bad[i + 1] + bad[i + 2];
if (cnt == 0) {
if (bits[pos] == 0 && bits[pos + 1] == 0) {
Set(i , 1);
Set(i + 1, 0);
Set(i + 2, 0);
} else if (bits[pos] == 0 && bits[pos + 1] == 1) {
Set(i , 1);
Set(i + 1, 0);
Set(i + 2, 1);
} else if (bits[pos + 1] == 0) {
Set(i , 0);
Set(i + 1, 1);
Set(i + 2, 1);
} else {
Set(i , 1);
Set(i + 1, 1);
Set(i + 2, 1);
}
pos += 2;
} else if (cnt == 1) {
if (bits[pos] == 0) {
if (!bad[i + 1]) {
Set(i , 0);
Set(i + 1, 1);
Set(i + 2, 0);
pos += 1;
} else if (bits[pos + 1] == 0) {
Set(i , 1);
Set(i + 1, 0);
Set(i + 2, 0);
pos += 2;
} else {
Set(i , 1);
Set(i + 1, 0);
Set(i + 2, 1);
pos += 2;
}
} else if (bad[i + 2]) {
Set(i , 1);
Set(i + 1, 1);
Set(i + 2, 0);
pos += 1;
} else {
Set(i , 0);
Set(i + 1, 0);
Set(i + 2, 1);
pos += 1;
}
} else {
Set(i, 0);
Set(i + 1, 0);
Set(i + 2, 0);
}
}
}
#include "Brunolib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
const int64_t value[] = {0, 1, 0, 1, 0, 2, 1, 3};
const int add[] = {0, 1, 1, 2, 2, 2, 1, 2};
long long Bruno( int N, int A[] ){
vector<int> bits(N, 0);
int64_t ans = 0;
int shift = 0;
for (int i = 0; i < N; i += 3) {
int v = 4 * A[i] + 2 * A[i + 1] + A[i + 2];
ans |= value[v] << shift;
shift += add[v];
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
