#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
//const int oo = 1e18 + 7, mod = 1e9 + 7;
int ret[100005];
void Anna(int n, vector<char> S){
int need = 0, occ = 0;
for(int i = n - 1; i >= 0; i--){
if(S[i] == 'Z'){
occ = 1;
ret[i] = 1;
}
else if(S[i] == 'X' && occ && (!i || S[i - 1] != 'X')){
ret[i] = 1;
}
}
for(int i = 0; i < n; i++) Send(ret[i]);
}
/*
void process(){
}
signed main(){
ios_base::sync_with_stdio(0);
process();
}*/
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define y1 zck_is_king
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define SQ(x) (x)*(x)
#define MN(a,b) a = min(a,(__typeof__(a))(b))
#define MX(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define REP(i,n) for (int i = 0; i<n; ++i)
#define RREP(i,n) for (int i = n-1; i>=0; --i)
#define REP1(i,n) for (int i = 1; i<=n; ++i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#ifdef BALBIT
#define IOS()
#define bug(...) fprintf(stderr,"#%d (%s) = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define bug(...)
#endif
namespace {
const int iinf = 1e9+10;
const ll inf = 1ll<<60;
const ll mod = 1e9+7 ;
const int maxn = 1e5+5;
int variable_example = 0;
int FunctionExample(int P) { return 1 - P; }
} // namespace
void Bruno(int n, int L, std::vector<int> A) {
int zpos = -1;
if (*max_element(ALL(A)) == 0) {
REP(i,n) {
Remove(i);
}
return;
}
for (int i = n-1; i>=0; --i) {
if (A[i] == 1) {
zpos = i;
break;
}else{
Remove(i);
}
}
int prv = zpos;
for (int i = zpos-1; i>=0; --i) {
if (A[i] == 1 || i == 0) {
// met an x
for (int j = i+1; j<prv; ++j) {
Remove(j);
}
Remove(i);
prv = i;
}
}
Remove(zpos);
}
Compilation message
Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:22:6: warning: unused variable 'need' [-Wunused-variable]
22 | int need = 0, occ = 0;
| ^~~~
Bruno.cpp:42:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
42 | int FunctionExample(int P) { return 1 - P; }
| ^~~~~~~~~~~~~~~
Bruno.cpp:40:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
40 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
496 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
52 ms |
8092 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |