#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define se second
void Anna(int n, vector<char> s){
for (int i=0; i<n; ++i){
if (s[i]=='X')Send(1), Send(1);
else if (s[i]=='Y')Send(1), Send(0);
else Send(0), Send(0);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define se second
void Bruno(int n, int l, vector<int> a){
stack<pii> st;//x, y, z=0, 1, 2
for (int i=0; i<2*n; i+=2){
if (a[i]&&a[i+1]){
st.push(mp(0, i/2));
}
else if (a[i]||a[i+1]){
while (st.size()&&st.top().fi)Remove(st.top().se), st.pop();
st.push(mp(1, i/2));
}
else{
while (st.size()&&st.top().fi!=1)Remove(st.top().se), st.pop();
if (st.size()>=2){
Remove(st.top().se);
st.pop();
Remove(st.top().se);
st.pop();
Remove(i/2);
}
else Remove(i/2);
}
}
while (st.size())Remove(st.top().se), st.pop();
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |