# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1139566 | Math4Life2020 | Ancient Machine (JOI21_ancient_machine) | C++20 | 0 ms | 0 KiB |
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
using ll = int; using pii = pair<ll,ll>;
void Anna(int N, vector<char> S) {
bool xfnd = 0;
for (ll i=0;i<N;i++) {
if (S[i]=='X' && !xfnd) {
xfnd = 1;
Send(1);
} else if (S[i]=='Z' && xfnd) {
Send(1);
} else {
Send(0);
}
}
}
#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;
using ll = int; using pii = pair<ll,ll>;
void Bruno(int N, int L, vector<int> A) {
ll cx = -1;
stack<int> s0;
for (int i=0;i<N;i++) {
if (A[i]==1) {
if (cx==-1) {
cx = i;
} else {
while (!s0.empty()) {
Remove((int)s0.top()); s0.pop();
}
Remove(i);
}
} else {
if (cx==-1) {
Remove(i);
} else {
s0.push(i);
}
}
}
while (!s0.empty()) {
Remove((int)s0.top()); s0.pop();
}
if (cx != -1) {
Remove(cx);
}
}