#include "Anna.h"
#include <vector>
namespace {
int variable_example = 0;
}
void Anna(int N, std::vector<char> S) {
for (int i = 0; i < N; i += 3) {
int now = 0;
for (int j = i; j < i + 3 && j < N; ++j)
now = now * 3 + S[j] - 'X';
for (int j = 4; ~j; --j)
Send(now >> j & 1);
}
}
#include "Bruno.h"
#include <vector>
namespace {
int variable_example = 0;
int FunctionExample(int P) { return 1 - P; }
} // namespace
void Bruno(int N, int L, std::vector<int> A) {
std::vector <char> S(N);
int pt = 0;
for (int i = 0; i < L; i += 5) {
int now = 0;
for (int j = i; j < i + 5; ++j)
now = now * 2 + A[j];
S[pt] = now / 9 + 'X';
if (pt + 1 < N)
S[pt + 1] = (now / 3) % 3 + 'X';
if (pt + 2 < N)
S[pt + 2] = now % 3 + 'X';
pt += 3;
}
std::vector <int> X, Y, Z;
std::vector <bool> vis(N, false);
for (int i = 0; i < N; ++i) {
if (S[i] == 'X')
X.push_back(i);
else if (S[i] == 'Y' && !X.empty())
Y.push_back(i);
else if (S[i] == 'Z' && !Y.empty()) {
int a = X.back(), b = Y.back();
for (int i = a + 1; i < b; ++i)
Remove(i), vis[i] = true;
for (int j = b + 1; j < i; ++j)
Remove(j), vis[j] = true;
Remove(b), Remove(a), Remove(i), vis[b] = vis[a] = vis[i] = true;
X.pop_back(), Y.pop_back();
}
}
for (int i = 0; i < N; ++i) if (!vis[i])
Remove(i);
}
Compilation message
Anna.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
6 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
Bruno.cpp:8:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
8 | int FunctionExample(int P) { return 1 - P; }
| ^~~~~~~~~~~~~~~
Bruno.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
6 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
488 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
3600 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |