#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
}
void Anna(int N, vector<char> S) {
for (int i = 0; i < N; i++){
int val = S[i] - 'X';
Send((val & 2) != 0);
Send((val & 1) != 0);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
const int MAXN = 100005;
int l[MAXN], r[MAXN], nums;
void rem(int x){
Remove(x - 1);
int lx = l[x], rx = r[x];
r[lx] = rx; l[rx] = lx;
}
} // namespace
void Bruno(int N, int L, vector<int> A) {
nums = N;
vector<int> vec(nums + 2);
for (int i = 0; i < nums; i++) vec[i + 1] = ((A[i << 1]) << 1) + A[(i << 1) + 1];
r[0] = 1;
for (int i = 1; i <= nums; i++){
l[i] = i - 1; r[i] = i + 1;
}
l[nums + 1] = nums;
int curr = 1;
while (curr != nums + 1){
if (vec[curr] != 1){
curr = r[curr]; continue;
}
if (l[curr] == 0){
rem(curr); curr = r[curr];
}
else if (r[curr] == nums + 1){
rem(curr); curr = r[curr];
}
else if (vec[l[curr]] != 0) rem(l[curr]);
else if (vec[r[curr]] != 2) rem(r[curr]);
else{
rem(curr); curr = r[curr];
}
}
for (int x = r[0]; x != nums + 1; x = r[x]) Remove(x - 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
892 KB |
Output is correct |
2 |
Correct |
1 ms |
784 KB |
Output is correct |
3 |
Correct |
0 ms |
784 KB |
Output is correct |
4 |
Correct |
0 ms |
796 KB |
Output is correct |
5 |
Incorrect |
0 ms |
784 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
59 ms |
10812 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |