#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.back() == 1) v.back() = 2;
else if (v.back() == 2) v.back() = 3;
else v.push_back(1);
} else {
v.push_back(-1);
for (int j = i; j < i + 2; j++) if (j < n && s[j] == 'Z') k = j;
i += 2;
}
if (i < n && s[i] == 'Z') k = i;
}
for (auto &i: s) {
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), 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 (a[j]) Remove(j);
for (int j = i + 1; j < lt; j++) if (!a[j] && j != rt) Remove(j);
if (i != rt) Remove(i);
lt = i;
}
Remove(rt);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
2032 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |