#include "Anna.h"
#include<bits/stdc++.h>
#define X first
#define Y second
#define all(x) begin(x), end(x)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, b, a) for(int i = (b); i >= (a); i--)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define mxx max_element
#define mnn min_element
#define SQR(x) (1LL * (x) * (x))
#define MASK(i) (1LL << (i))
#define Point Vector
#define left Left
#define right Right
#define div Div
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<db, db> pdb;
typedef pair<ld, ld> pld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
typedef pair<ll, int> pli;
typedef pair<ll, pii> plii;
template<class A, class B>
bool maximize(A& x, B y) {
if (x < y) return x = y, true; else return false;
}
template<class A, class B>
bool minimize(A& x, B y) {
if (x > y) return x = y, true; else return false;
}
/* END OF TEMPLATE */
const int N = 1e5 + 7;
int n, m;
void Anna(int n, vector<char> S) {
bool kt = false;
REP(i, 0, n)
if (S[i] == 'X') {
REP(j, 0, i) Send(0);
Send(1);
REP(j, i + 1, n)
if (S[j] == 'Z') Send(1); else Send(0);
return ;
}
REP(i, 0, n) Send(0);
}
#include "Bruno.h"
#include<bits/stdc++.h>
#define X first
#define Y second
#define all(x) begin(x), end(x)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, b, a) for(int i = (b); i >= (a); i--)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define mxx max_element
#define mnn min_element
#define SQR(x) (1LL * (x) * (x))
#define MASK(i) (1LL << (i))
#define Point Vector
#define left Left
#define right Right
#define div Div
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<db, db> pdb;
typedef pair<ld, ld> pld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
typedef pair<ll, int> pli;
typedef pair<ll, pii> plii;
template<class A, class B>
bool maximize(A& x, B y) {
if (x < y) return x = y, true; else return false;
}
template<class A, class B>
bool minimize(A& x, B y) {
if (x > y) return x = y, true; else return false;
}
/* END OF TEMPLATE */
const int N = 1e5 + 7;
void Bruno(int n, int L, vector<int> A) {
if (*mxx(all(A)) == 0) {
REP(i, 0, n) Remove(i);
return ;
}
int pos = -1;
REP(i, 0, L)
if (A[i] == 1) {
pos = i;
break;
}
REP(i, 0, pos) Remove(i);
if (pos == n - 1) {
Remove(pos);
return ;
}
int i = pos;
while (i < n) {
if (i == n - 1) break;
int j = i + 1;
while (j < n && A[j] == 0) j++;
if (j >= n) {
REP(k, i + 1, n) Remove(k);
i = n - 1;
break;
}
FORD(k, j - 1, i + 1) Remove(k);
if (j > pos) Remove(j);
i = j;
}
if (pos != i) Remove(pos);
}
Compilation message
Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:47:10: warning: unused variable 'kt' [-Wunused-variable]
47 | bool kt = false;
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
792 KB |
Output is correct |
2 |
Correct |
0 ms |
784 KB |
Output is correct |
3 |
Correct |
0 ms |
796 KB |
Output is correct |
4 |
Correct |
1 ms |
784 KB |
Output is correct |
5 |
Correct |
0 ms |
796 KB |
Output is correct |
6 |
Correct |
0 ms |
796 KB |
Output is correct |
7 |
Correct |
0 ms |
796 KB |
Output is correct |
8 |
Correct |
0 ms |
796 KB |
Output is correct |
9 |
Correct |
0 ms |
796 KB |
Output is correct |
10 |
Correct |
1 ms |
992 KB |
Output is correct |
11 |
Correct |
0 ms |
784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
46 ms |
7912 KB |
Partially correct |
2 |
Partially correct |
41 ms |
8460 KB |
Partially correct |
3 |
Partially correct |
39 ms |
8236 KB |
Partially correct |
4 |
Partially correct |
42 ms |
8280 KB |
Partially correct |
5 |
Partially correct |
45 ms |
8088 KB |
Partially correct |
6 |
Partially correct |
40 ms |
8284 KB |
Partially correct |
7 |
Partially correct |
39 ms |
8228 KB |
Partially correct |
8 |
Partially correct |
39 ms |
8292 KB |
Partially correct |
9 |
Partially correct |
39 ms |
8428 KB |
Partially correct |
10 |
Partially correct |
39 ms |
8312 KB |
Partially correct |
11 |
Partially correct |
39 ms |
8356 KB |
Partially correct |
12 |
Partially correct |
39 ms |
8420 KB |
Partially correct |
13 |
Partially correct |
44 ms |
8364 KB |
Partially correct |
14 |
Partially correct |
44 ms |
8444 KB |
Partially correct |
15 |
Partially correct |
40 ms |
8452 KB |
Partially correct |
16 |
Partially correct |
42 ms |
8456 KB |
Partially correct |
17 |
Partially correct |
54 ms |
8344 KB |
Partially correct |
18 |
Partially correct |
46 ms |
8456 KB |
Partially correct |
19 |
Partially correct |
54 ms |
8520 KB |
Partially correct |
20 |
Partially correct |
41 ms |
8344 KB |
Partially correct |
21 |
Partially correct |
41 ms |
8380 KB |
Partially correct |
22 |
Partially correct |
47 ms |
8316 KB |
Partially correct |
23 |
Partially correct |
39 ms |
8320 KB |
Partially correct |
24 |
Partially correct |
43 ms |
8412 KB |
Partially correct |
25 |
Partially correct |
45 ms |
8164 KB |
Partially correct |
26 |
Partially correct |
46 ms |
8252 KB |
Partially correct |
27 |
Partially correct |
44 ms |
8364 KB |
Partially correct |
28 |
Partially correct |
45 ms |
8180 KB |
Partially correct |
29 |
Partially correct |
45 ms |
8276 KB |
Partially correct |
30 |
Partially correct |
44 ms |
8196 KB |
Partially correct |
31 |
Partially correct |
44 ms |
8396 KB |
Partially correct |
32 |
Partially correct |
39 ms |
8356 KB |
Partially correct |
33 |
Partially correct |
41 ms |
8172 KB |
Partially correct |