#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
void Anna(int n, std::vector<char> s) {
for (int i = 0; i < n; i += 5) {
int x = 0;
for (int j = i; j < min(n, i + 5); ++j) {
x = x * 3 + (s[j] == 'X' ? 0 : s[j] == 'Y' ? 1 : 2);
}
for (int _ = 0; (i + 5 >= n ? x : _ < 8); ++_) {
Send(x % 2);
x /= 2;
}
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
void Bruno(int N, int L, std::vector<int> A) {
vector<char> s(N, 'X');
int si = 0;
for (int i = 0; i < L; i += 8, si += 5) {
int x = 0;
for (int j = i; j < min(L, i + 8); ++j) {
x += (A[j]) << (j - i);
}
for (int sj = min(N, si + 5) - 1; sj >= si; --sj) {
s[sj] = x % 3 == 0 ? 'X' : x % 3 == 1 ? 'Y' : 'Z';
x /= 3;
}
}
vector<int> stk;
int xy = 0;
for (int i = 0; i < N; ++i) {
if (s[i] == 'Y') {
if (!stk.empty()) {
stk.push_back(i);
} else {
Remove(i);
}
} else if (s[i] == 'X') {
stk.push_back(i);
} else {
while (stk.size() > 1) {
Remove(stk.back());
stk.pop_back();
}
Remove(i);
xy = 0;
}
}
for (int x : stk) {
Remove(x);
}
}
Compilation message
Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:21:9: warning: variable 'xy' set but not used [-Wunused-but-set-variable]
21 | int xy = 0;
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
508 KB |
Output is correct |
2 |
Correct |
1 ms |
608 KB |
Output is correct |
3 |
Correct |
0 ms |
508 KB |
Output is correct |
4 |
Correct |
1 ms |
508 KB |
Output is correct |
5 |
Correct |
0 ms |
516 KB |
Output is correct |
6 |
Correct |
0 ms |
508 KB |
Output is correct |
7 |
Correct |
0 ms |
516 KB |
Output is correct |
8 |
Correct |
1 ms |
504 KB |
Output is correct |
9 |
Correct |
0 ms |
516 KB |
Output is correct |
10 |
Correct |
0 ms |
508 KB |
Output is correct |
11 |
Correct |
1 ms |
516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
68 ms |
8636 KB |
Partially correct |
2 |
Partially correct |
63 ms |
8672 KB |
Partially correct |
3 |
Partially correct |
65 ms |
8636 KB |
Partially correct |
4 |
Partially correct |
67 ms |
8668 KB |
Partially correct |
5 |
Partially correct |
69 ms |
8668 KB |
Partially correct |
6 |
Partially correct |
63 ms |
8636 KB |
Partially correct |
7 |
Partially correct |
71 ms |
8620 KB |
Partially correct |
8 |
Partially correct |
62 ms |
8564 KB |
Partially correct |
9 |
Partially correct |
62 ms |
8724 KB |
Partially correct |
10 |
Partially correct |
63 ms |
8688 KB |
Partially correct |
11 |
Partially correct |
63 ms |
8636 KB |
Partially correct |
12 |
Partially correct |
67 ms |
8728 KB |
Partially correct |
13 |
Partially correct |
81 ms |
9052 KB |
Partially correct |
14 |
Partially correct |
79 ms |
8676 KB |
Partially correct |
15 |
Partially correct |
72 ms |
8668 KB |
Partially correct |
16 |
Partially correct |
68 ms |
8696 KB |
Partially correct |
17 |
Partially correct |
67 ms |
8972 KB |
Partially correct |
18 |
Partially correct |
68 ms |
8668 KB |
Partially correct |
19 |
Partially correct |
72 ms |
8700 KB |
Partially correct |
20 |
Partially correct |
61 ms |
8592 KB |
Partially correct |
21 |
Partially correct |
64 ms |
8668 KB |
Partially correct |
22 |
Partially correct |
83 ms |
9060 KB |
Partially correct |
23 |
Partially correct |
63 ms |
8680 KB |
Partially correct |
24 |
Partially correct |
61 ms |
8664 KB |
Partially correct |
25 |
Partially correct |
73 ms |
8756 KB |
Partially correct |
26 |
Partially correct |
74 ms |
9108 KB |
Partially correct |
27 |
Partially correct |
74 ms |
8672 KB |
Partially correct |
28 |
Partially correct |
71 ms |
9008 KB |
Partially correct |
29 |
Partially correct |
72 ms |
8628 KB |
Partially correct |
30 |
Partially correct |
68 ms |
8664 KB |
Partially correct |
31 |
Partially correct |
71 ms |
8644 KB |
Partially correct |
32 |
Partially correct |
67 ms |
8764 KB |
Partially correct |
33 |
Partially correct |
74 ms |
8668 KB |
Partially correct |