#include "Anna.h"
#include <vector>
using namespace std;
void Anna(int n, vector<char> s) {
int k = 0;
vector<int> v;
for (int i = 0; i < n; i++) {
if (s[i] != 'X') {
if (!v.empty() && v.back() == 1) v.back() = 2;
else if (!v.empty() && v.back() == 2) v.back() = 3;
else v.push_back(1);
} else {
v.push_back(-1);
for (int j = i; j < i + 1; j++) if (j < n && s[j] == 'Z') k = j;
i++;
}
if (i < n && s[i] == 'Z') k = i;
}
for (auto &i: v) {
if (i == 1) Send(0), Send(0);
else if (i == 2) Send(0), Send(1);
else if (i == 3) Send(1), Send(0);
else Send(1), Send(1);
}
for (int t = 0; t <= 16; t++) Send(k & 1 << t ? 1 : 0);
}
#include "Bruno.h"
#include <vector>
using namespace std;
void Bruno(int n, int l, vector<int> b) {
int lt = n, rt = 0;
vector<int> a;
for (int i = 0; i < (int)b.size() - 17; i += 2) {
if (!b[i] && !b[i + 1]) a.push_back(0);
else if (!b[i]) a.push_back(0), a.push_back(0);
else if (!b[i + 1]) a.push_back(0), a.push_back(0), a.push_back(0);
else a.push_back(1), a.push_back(0);
}
while ((int)a.size() > n) a.pop_back();
for (int i = (int)b.size() - 17; i < (int)b.size(); i++) a.push_back(b[i]);
for (int t = 0; t <= 16; t++) if (a[n + t]) rt |= 1 << t;
for (int i = n - 1; i >= 0; i--) if (a[i] || !i) {
for (int j = i + 1; j < lt; j++) if (j != rt) Remove(j);
if (i != rt) Remove(i);
lt = i;
}
Remove(rt);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
508 KB |
Output is correct |
2 |
Correct |
1 ms |
584 KB |
Output is correct |
3 |
Correct |
0 ms |
520 KB |
Output is correct |
4 |
Correct |
0 ms |
520 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
512 KB |
Output is correct |
7 |
Correct |
1 ms |
520 KB |
Output is correct |
8 |
Correct |
0 ms |
520 KB |
Output is correct |
9 |
Correct |
0 ms |
520 KB |
Output is correct |
10 |
Correct |
0 ms |
512 KB |
Output is correct |
11 |
Correct |
1 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
57 ms |
8332 KB |
Partially correct |
2 |
Partially correct |
59 ms |
8356 KB |
Partially correct |
3 |
Partially correct |
71 ms |
8300 KB |
Partially correct |
4 |
Partially correct |
52 ms |
8284 KB |
Partially correct |
5 |
Partially correct |
55 ms |
8360 KB |
Partially correct |
6 |
Partially correct |
55 ms |
8496 KB |
Partially correct |
7 |
Partially correct |
55 ms |
8328 KB |
Partially correct |
8 |
Partially correct |
53 ms |
8328 KB |
Partially correct |
9 |
Partially correct |
51 ms |
8472 KB |
Partially correct |
10 |
Partially correct |
52 ms |
8356 KB |
Partially correct |
11 |
Partially correct |
67 ms |
8420 KB |
Partially correct |
12 |
Partially correct |
54 ms |
8356 KB |
Partially correct |
13 |
Partially correct |
62 ms |
8324 KB |
Partially correct |
14 |
Correct |
53 ms |
8080 KB |
Output is correct |
15 |
Partially correct |
64 ms |
9220 KB |
Partially correct |
16 |
Partially correct |
65 ms |
9268 KB |
Partially correct |
17 |
Partially correct |
63 ms |
8324 KB |
Partially correct |
18 |
Correct |
55 ms |
8024 KB |
Output is correct |
19 |
Correct |
54 ms |
8060 KB |
Output is correct |
20 |
Partially correct |
55 ms |
8272 KB |
Partially correct |
21 |
Partially correct |
49 ms |
8308 KB |
Partially correct |
22 |
Correct |
53 ms |
7936 KB |
Output is correct |
23 |
Partially correct |
54 ms |
8472 KB |
Partially correct |
24 |
Partially correct |
54 ms |
8524 KB |
Partially correct |
25 |
Correct |
55 ms |
7904 KB |
Output is correct |
26 |
Correct |
56 ms |
7924 KB |
Output is correct |
27 |
Correct |
55 ms |
7932 KB |
Output is correct |
28 |
Correct |
57 ms |
7996 KB |
Output is correct |
29 |
Correct |
61 ms |
7920 KB |
Output is correct |
30 |
Correct |
56 ms |
7996 KB |
Output is correct |
31 |
Correct |
54 ms |
7968 KB |
Output is correct |
32 |
Partially correct |
56 ms |
8272 KB |
Partially correct |
33 |
Partially correct |
53 ms |
8232 KB |
Partially correct |