#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
string str[] = {"0", "0", "1", "00", "10", "11", "0", "01"};
bool bad[200];
int cnt;
void Anna(int N, long long X, int K, int P[]) {
cnt = 0;
for (int i = 0; i < N; i++)
bad[i] = false;
for (int i = 0; i < K; i++)
bad[P[i]] = true;
long long ptr = 0;
for (int i = 0; i < N; i += 3) {
int cnt = bad[i] + bad[i + 1] + bad[i + 2];
if (cnt >= 2 || ptr >= 64) {
Set(i, 0);
Set(i + 1, 0);
Set(i + 2, 0);
continue;
}
if (cnt == 0) {
bool found = false;
for (int j = 1; j <= 7; j++) {
if (str[j].size() == 1) {
continue;
}
int bit0 = (X >> ptr & 1);
int bit1 = (X >> (ptr + 1) & 1);
if ((str[j][0] - '0') == bit0 && (str[j][1] - '0') == bit1) {
Set(i, j >> 2 & 1);
Set(i + 1, j >> 1 & 1);
Set(i + 2, j >> 0 & 1);
found = true;
break;
}
}
assert(found);
ptr += 2;
continue;
}
int f = (bad[i] ? 2 : (bad[i + 1] ? 1 : 0));
bool found = false;
for (int j = 1; j <= 7; j++) {
if (j >> f & 1) {
continue;
}
bool ok = true;
for (int k = 0; k < (int) str[j].size(); k++) {
int bit = (X >> (ptr + k) & 1);
if (bit != (str[j][k] - '0')) {
ok = false;
}
}
if (ok) {
found = true;
Set(i, j >> 2 & 1);
Set(i + 1, j >> 1 & 1);
Set(i + 2, j >> 0 & 1);
ptr += str[j].size();
break;
}
}
assert(found);
}
assert(cnt == N);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
string str[] = {"0", "0", "1", "00", "10", "11", "0", "01"};
long long Bruno(int N, int A[]) {
long long bit = 0;
long long ans = 0;
for (int i = 0; i < N; i += 3) {
int x = A[i] * 4 + A[i + 1] * 2 + A[i + 2];
if (x == 0) {
continue;
}
for (int j = 0; j < (int) str[x].size(); j++) {
int d = (str[x][j] - '0');
ans += (1LL << bit) * d;
bit += 1;
}
if (bit >= 60) {
break;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Runtime error |
1 ms |
448 KB |
Execution killed with signal 6 |
3 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
4 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
5 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
6 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 6 |
7 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 6 |
8 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
9 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 6 |
10 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
11 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
12 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
13 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
14 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
15 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
16 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
17 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
18 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
19 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
20 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 6 |
21 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 6 |
22 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
23 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
24 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
25 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
26 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
27 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
28 |
Runtime error |
1 ms |
448 KB |
Execution killed with signal 6 |
29 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
30 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
31 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
32 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
33 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
34 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
35 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 6 |
36 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
37 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
38 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 6 |
39 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
40 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |