#include<bits/stdc++.h>
#include "Anna.h"
#include <vector>
using namespace std;
#define task "a"
#define se second
#define fi first
#define ll long long
#define ii pair<ll, ll>
const long mxN = 2e5 + 7, inf = 1e9 + 7;
void Anna(int n, std::vector<char> s)
{
for (char i : s)
{
if (i == 'X')
{
Send(0);
Send(0);
}
if (i == 'Y')
{
Send(0);
Send(1);
}
if (i == 'Z')
{
Send(1);
Send(1);
}
}
}
#include "Bruno.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
#define task "a"
#define se second
#define fi first
#define ll long long
#define ii pair<ll, ll>
const long mxN = 2e5 + 7;
void Bruno(int n, int l, std::vector<int> a)
{
string s;
for (int i = 0; i < n; i++)
{
if (a[i * 2] != a[i * 2 + 1])
s += 'Y';
else
{
if (!a[i * 2])
s += 'X';
else
s += 'Z';
}
}
cout << s << '\n';
int stt = -1;
stack<int> stk;
for (int i = 0; i < n; i++)
{
if (s[i] == 'X' && stt == -1)
stt = i;
if (stt == -1)
{
Remove(i);
continue;
}
if (s[i] == 'Z')
{
while (stk.size() > 1)
{
Remove(stk.top());
stk.pop();
}
Remove(i);
}
else
stk.push(i);
}
while (stk.size())
{
Remove(stk.top());
stk.pop();
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |