#include "Anna.h"
#include <vector>
void Anna(int n, std::vector<char> s)
{
for(int i = 0; i < n; i++)
{
if(s[i] == 'X')
{
Send(0);
Send(0);
}
else if(s[i] == 'Y')
{
Send(0);
Send(1);
}
else
{
Send(1);
Send(0);
}
}
}
#include "Bruno.h"
#include <vector>
#include <stack>
using namespace std;
const int MAXN = 1e5 + 10;
int type[MAXN];
void Bruno(int n, int l, std::vector<int> a)
{
for(int i = 0; i < l; i += 2)
{
type[i / 2] = a[i] * 2 + a[i + 1] * 1;
}
stack < int > st;
for(int i = 0; i < n; i++)
{
if(type[i] == 0)
{
st.push(i);
}
else if(type[i] == 1)
{
if(!st.empty())
st.push(i);
else
Remove(i);
}
else
{
while(st.size() >= 2)
{
int p = st.top();
st.pop();
Remove(p);
}
Remove(i);
}
}
while(!st.empty())
{
int p = st.top();
st.pop();
Remove(p);
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |