#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
void set(int i, string s) {
for (auto j : {0, 1, 2}) {
Set(i + j, s[j] - '0');
}
}
void msg(int i, int type) {
if (type == 0) {
set(i, "000");
} else if (type == 1) {
set(i, "011");
} else if (type == 2) {
set(i, "101");
} else if (type == 3) {
set(i, "111");
} else if (type == 4) {
set(i, "100");
} else if (type == 5) {
set(i, "001");
} else {
set(i, "010");
}
}
int conv(string s) {
if (s == "10") {
return 1;
}
if (s == "01") {
return 2;
}
return 3;
}
}
void Anna(int N, long long X, int K, int *P) {
vector<bool> broke(N);
for (int i = 0; i < K; ++i) {
broke[P[i]] = 1;
}
int ptr = 0;
for (int i = 0; i < N; i += 3) {
if (ptr == 60) {
msg(i, 0);
}
int cnt = 0;
for (auto j : {0, 1, 2}) {
cnt += broke[i + j];
}
if (cnt > 1) {
msg(i, 0);
} else if (cnt == 1) {
string m;
m += (X >> ptr++ & 1) + '0';
msg(i, conv(m));
} else {
int c = X >> ptr++ & 1;
if (c == 0) {
msg(i, 6);
} else {
msg(i, broke[i] ? 5 : 4);
}
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
string decode(string m) {
if (m == "000") {
return "";
}
if (m == "011") {
return "10";
}
if (m == "101") {
return "01";
}
if (m == "111") {
return "11";
}
if (m == "100" || m == "001") {
return "1";
}
return "0";
}
}
long long Bruno(int N, int *A) {
string S;
for (int i = 0; i < N; i += 3) {
string m;
for (auto j : {0, 1, 2}) {
m += A[i + j] + '0';
}
S += decode(m);
}
long long res = 0;
for (int i = 0; i < 60; ++i) {
if (S[i] == '1') {
res += 1LL << i;
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
23 ms |
2756 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
23 ms |
2808 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
24 ms |
2840 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
23 ms |
2808 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
24 ms |
2784 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
24 ms |
2804 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
24 ms |
2776 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
24 ms |
3028 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
28 ms |
2820 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
24 ms |
2868 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
23 ms |
2776 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
22 ms |
2768 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
28 ms |
2780 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
25 ms |
2772 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
23 ms |
2772 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
27 ms |
2776 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
25 ms |
2712 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
23 ms |
2768 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
26 ms |
2880 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
23 ms |
2812 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
24 ms |
2868 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
23 ms |
2792 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
24 ms |
2756 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
23 ms |
2856 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
24 ms |
2868 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
25 ms |
2776 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
22 ms |
2868 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
23 ms |
2780 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
23 ms |
2784 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
23 ms |
2780 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
23 ms |
2772 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
23 ms |
2780 KB |
Output isn't correct - L* = 0 |