#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
namespace {
int n;
}
void Anna(int N, vector<char> S) {
n = N;
for (int i = 0;i < n;i++) {
int v = S[i] - 'X';
Send(!!(v & 1));
Send(!!(v & 2));
}
}
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
namespace {
int n;
int a[100100];
} // namespace
void Bruno(int N, int L, vector<int> A) {
n = N;
for (int i = 0;i < n;i++) {
a[i] = A[2 * i] + 2 * A[2 * i + 1];
}
stack<int> x, z;
for (int i = n - 1;i >= 0;i--) if (a[i] == 2) z.push(i);
for (int i = 0;i < n;i++) {
while (!z.empty() && z.top() < i) z.pop();
if (a[i] == 0) x.push(i);
else if (a[i] == 1) {
if (x.empty() || z.empty()) {
Remove(i);
continue;
}
int l = x.top(), r = z.top();
x.pop(), z.pop();
for (int j = i + 1;j < r;j++) Remove(j);
Remove(i);
Remove(l), Remove(r);
i = r;
}
else {
Remove(i);
z.pop();
}
}
while (!x.empty()) {
Remove(x.top());
x.pop();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
780 KB |
Output is correct |
2 |
Correct |
0 ms |
784 KB |
Output is correct |
3 |
Correct |
0 ms |
796 KB |
Output is correct |
4 |
Correct |
0 ms |
792 KB |
Output is correct |
5 |
Incorrect |
0 ms |
776 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
44 ms |
9784 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |