#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){
vector<int> res(n, 0);
bool found=0;
for (int i=0; i<n; ++i){
if (!found){
if (s[i]=='X')found=1, res[i]=1;
continue;
}
if (s[i]=='Z'&&(i==n-1||s[i+1]!='Z')&&!(s[i-1]=='X'&&res[i-1]))res[i]=1;
}
for (auto a:res)Send(a);
}
#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){
vector<int> vect;
for (int i=0; i<n; ++i)if (a[i])vect.pb(i);
if (vect.size()<=1){
for (int i=0; i<n; ++i)Remove(i);
return;
}
for (int i=0; i<vect[0]; ++i)Remove(i);
for (int i=vect.back()+1; i<n; ++i)Remove(i);
for (int i=1; i<vect.size(); ++i){
for (int j=vect[i]-1; j>vect[i-1]; --j)Remove(j);
Remove(vect[i]);
}
Remove(vect[0]);
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |