#include <bits/stdc++.h>
#include "Anna.h"
using namespace std;
string res = "";
void check(int x) {
while (x >= 3) {
res += "11";
x -= 3;
}
if (x == 0) res += "00";
else if (x == 1) res += "01";
else res += "10";
}
void Anna(int n, vector<char> s) {
vector<int> v;
int fl = 0, h = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == 'X' && fl == 0) {
fl = 1;
v.push_back(i);
}
else if (s[i] == 'Y' && fl == 1) {
if (h != v.back() && h != 0) {
v.push_back(h);
}
}
else if (s[i] == 'Z') h = i;
}
if (!v.empty()) {
if (h != v.back() && h != 0) v.push_back(h);
}
h = -1;
for (int w : v) {
check(w - h - 1);
h = w;
}
for (int i = 0; i < res.size(); i++) Send(res[i] - '0');
}
#include <bits/stdc++.h>
#include "Bruno.h"
using namespace std;
void Bruno(int n, int l, vector<int> v) {
int k = 0, c = -1;
if (v.empty()) {
for (int i = 0; i < n; i++) Remove(i);
return;
}
vector<int> vv;
for (int i = 0; i < l; i += 2) {
int h = 0;
if (v[i] == 1) h += 2;
if (v[i + 1] == 1) h++;
k += h;
if (h != 3) {
vv.push_back(c + k + 1);
c += k + 1;
k = 0;
}
}
for (int i = 1; i < vv.size(); i++) {
for (int j = vv[i] - 1; j > vv[i - 1]; j--) {
Remove(j);
}
Remove(vv[i]);
}
for (int i = 0; i <= vv[0]; i++) Remove(i);
for (int i = vv.back() + 1; i < n; i++) Remove(i);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |