#ifndef davele
#include "Anna.h"
#endif // davele
#include <bits/stdc++.h>
#define pii pair<int, int>
#define fi first
#define se second
#define vi vector <int>
#define pq priority_queue
#define MASK(i) (1ll<<(i))
#define BIT(x, i) (((x) >> (i)) & 1)
#define x0 ___x0
#define y0 ___y0
#define div ___div
#define next ___next
#define prev ___prev
#define left ___left
#define right ___right
#define pos pisosi
#define pb push_back
#define pf push_front
using namespace std;
//const int mod = ;
//void add (int &a, const int&b){
// a+=b;
// if (a>=mod) a-=mod;
//}
//
//void sub (int&a, const int&b){
// a-=b;
// if (a<0) a+=mod;
//}
//
//void mul (int&a, const int&b){
// a*=b;
// a%=mod;
//}
template<class X, class Y>
bool minimize(X &x, const Y&y){
if (x<=y) return false;
else{
x = y;
return true;
}
}
template<class X, class Y>
bool maximize (X &x, const Y&y){
if (x>=y) return false;
else{
x = y;
return true;
}
}
/////////////////////////////////////////////////////////////////////////////////
void Anna (int n, std::vector<char> S){
string s=" ";
for (char x:S) s+=x;
int last = n;
for (int i=1; i<=n; i++){
if (s[i]=='X'){
Send(1);
last = i;
break;
}
Send(0);
}
if (last==n) return;
for (int i=last+1; i<=n; i++){
if (s[i]=='Z'){
if (i!=last+1 && (s[i]!=s[i+1] || i==n)) Send(1);
else Send(0);
}
else Send(0);
}
}
#ifndef davele
#include "Bruno.h"
#endif // davele
#include <bits/stdc++.h>
#define pii pair<int, int>
#define fi first
#define se second
#define vi vector <int>
#define pq priority_queue
#define MASK(i) (1ll<<(i))
#define BIT(x, i) (((x) >> (i)) & 1)
#define x0 ___x0
#define y0 ___y0
#define div ___div
#define next ___next
#define prev ___prev
#define left ___left
#define right ___right
#define pos pisosi
#define pb push_back
#define pf push_front
using namespace std;
//const int mod = ;
//void add (int &a, const int&b){
// a+=b;
// if (a>=mod) a-=mod;
//}
//
//void sub (int&a, const int&b){
// a-=b;
// if (a<0) a+=mod;
//}
//
//void mul (int&a, const int&b){
// a*=b;
// a%=mod;
//}
template<class X, class Y>
bool minimize(X &x, const Y&y){
if (x<=y) return false;
else{
x = y;
return true;
}
}
template<class X, class Y>
bool maximize (X &x, const Y&y){
if (x>=y) return false;
else{
x = y;
return true;
}
}
/////////////////////////////////////////////////////////////////////////////////
void Bruno (int n, int l, std::vector<int> b){
bool have1 = false;
for (int i = n-1; i>=0; i--){
if (b[i]==1){
have1 = true;
break;
}
Remove(i);
}
if (!have1) return;
for (int i=0; i<n; i++){
if (b[i]==1){
break;
}
Remove(i);
}
vector <int> list1;
for (int i=0; i<n; i++) if (b[i]==1) list1.pb(i);
for (int i=1; i<list1.size(); i++){
int st = list1[i-1]+1;
int en = list1[i]-1;
for (int j=en; j>=st; j--) Remove(j);
Remove(list1[i]);
}
Remove(list1[0]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |