#include "Anna.h"
#include <bits/stdc++.h>
#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif
using namespace std;
void Anna(int N, std::vector<char> S) {
vector<int> R(N);
bool chk=false;
int s=N, e=0;
for(int i=0;i<N;i++) {
if(S[i]=='X') s=min(s,i);
else if(S[i]=='Z') e=i;
}
if(s>=e) return;
R[s]=R[e]=1;
for(int i=s+1;i<e;i++) if(S[i]=='Y' && S[i+1]!='Y') {
R[i]=1; R[i+1]=S[i+1]=='Z'; chk=true;
}
if(chk)for(auto r: R) Send(r);
}
#include "Bruno.h"
#include <bits/stdc++.h>
#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif
using namespace std;
void Bruno(int N, int L, std::vector<int> A) {
int s=N, e=0, p=-1;
if(L==0) {
for(int i=0;i<N;i++) Remove(i);
return;
}
for(int i=0;i<N;i++) if(A[i]) {
s=min(s,i);
e=i;
}
vector<char> S(N);
vector<int> I;
for(int i=0;i<N;i++) S[i]='?';
for(int i=s+1;i<e;i++) if(A[i]) {
S[i++]='Y';
S[i]=A[i] ? 'Z':'X';
}
S[s]='X'; S[e]='Z';
for(int i=0;i<N;i++) {
if(S[i]=='?') Remove(i);
else if(S[i]=='Y') p=i+1;
}
if(p<e) {
Remove(p);
S[p]='?';
}
for(int i=0;i<N;i++) if(S[i]!='?') {
if(S[i]=='Z') {
for(;;) {
Remove(I.back());
I.pop_back();
if(I.size()==1) {
Remove(i);
break;
}
Remove(I.back());
I.pop_back();
}
}
else I.push_back(i);
}
while(I.size()) {
Remove(I.back());
I.pop_back();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
484 KB |
Output is correct |
2 |
Correct |
0 ms |
484 KB |
Output is correct |
3 |
Correct |
1 ms |
484 KB |
Output is correct |
4 |
Correct |
0 ms |
548 KB |
Output is correct |
5 |
Correct |
0 ms |
484 KB |
Output is correct |
6 |
Correct |
0 ms |
484 KB |
Output is correct |
7 |
Correct |
0 ms |
484 KB |
Output is correct |
8 |
Correct |
0 ms |
492 KB |
Output is correct |
9 |
Correct |
0 ms |
492 KB |
Output is correct |
10 |
Correct |
0 ms |
492 KB |
Output is correct |
11 |
Correct |
0 ms |
484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
71 ms |
8116 KB |
Partially correct |
2 |
Partially correct |
71 ms |
8012 KB |
Partially correct |
3 |
Partially correct |
69 ms |
8132 KB |
Partially correct |
4 |
Partially correct |
71 ms |
8140 KB |
Partially correct |
5 |
Partially correct |
76 ms |
8036 KB |
Partially correct |
6 |
Partially correct |
68 ms |
8080 KB |
Partially correct |
7 |
Partially correct |
69 ms |
8140 KB |
Partially correct |
8 |
Partially correct |
68 ms |
8156 KB |
Partially correct |
9 |
Partially correct |
72 ms |
8176 KB |
Partially correct |
10 |
Partially correct |
72 ms |
8052 KB |
Partially correct |
11 |
Partially correct |
68 ms |
8152 KB |
Partially correct |
12 |
Partially correct |
72 ms |
8184 KB |
Partially correct |
13 |
Partially correct |
72 ms |
8288 KB |
Partially correct |
14 |
Partially correct |
72 ms |
8180 KB |
Partially correct |
15 |
Partially correct |
64 ms |
8104 KB |
Partially correct |
16 |
Partially correct |
65 ms |
8284 KB |
Partially correct |
17 |
Correct |
49 ms |
6820 KB |
Output is correct |
18 |
Correct |
51 ms |
6816 KB |
Output is correct |
19 |
Correct |
54 ms |
6816 KB |
Output is correct |
20 |
Partially correct |
66 ms |
8296 KB |
Partially correct |
21 |
Partially correct |
64 ms |
8048 KB |
Partially correct |
22 |
Partially correct |
71 ms |
8028 KB |
Partially correct |
23 |
Partially correct |
66 ms |
8064 KB |
Partially correct |
24 |
Partially correct |
65 ms |
8164 KB |
Partially correct |
25 |
Correct |
51 ms |
6720 KB |
Output is correct |
26 |
Correct |
52 ms |
6684 KB |
Output is correct |
27 |
Correct |
51 ms |
6672 KB |
Output is correct |
28 |
Correct |
52 ms |
6780 KB |
Output is correct |
29 |
Correct |
53 ms |
6816 KB |
Output is correct |
30 |
Correct |
51 ms |
6760 KB |
Output is correct |
31 |
Correct |
51 ms |
6804 KB |
Output is correct |
32 |
Partially correct |
72 ms |
8132 KB |
Partially correct |
33 |
Partially correct |
71 ms |
8124 KB |
Partially correct |