#include <bits/stdc++.h>
#include "Anna.h"
using namespace std;
void send(char x) {
if (x == 'X') {
Send(0);
Send(0);
}
else if (x == 'Y') {
Send(0);
Send(1);
}
else Send(1);
}
void Anna(int n,vector<char> s) {
for (int i=0;i<n;++i) send(s[i]);
}
#include <bits/stdc++.h>
#include "Bruno.h"
#define N 100005
#define pii pair<int,int>
#define fi first
#define se second
#define pb emplace_back
#define getbit(x,y) (((x)>>(y))&1)
#define getoff(x,y) ((x)^(1<<(y)))
using namespace std;
int n,l;
char a[N];
bool erased[N];
vector<int> s;
void Bruno(int n1,int l1,vector<int> s1) {
n = n1; l = l1; s = s1;
int m = 0;
for (int i=0;i<n;++i)
if (s[m] == 0) {
if (s[m+1] == 0) a[i+1] = 'X';
else a[i+1] = 'Y';
m += 2;
}
else {
a[i+1] = 'Z';
++m;
}
int x = -1;
for (int i=1;i<=n;++i)
if (a[i] == 'X') {
x = i;
break;
}
if (x == -1) {
for (int i=0;i<n;++i) Remove(i);
return;
}
int z = x + 1;
while (z <= n) {
int t = z;
while (t <= n && a[t] != 'Z') ++t;
if (t == n + 1) {
for (int i=z;i<t;++i) Remove(i-1);
break;
}
int p = t - 1;
while (p >= z) {
int pos = -1; int q = p;
while (p >= z && a[p] != 'X') --p;
for (int i=p+1;i<=q;++i)
if (a[i] == 'Y') {
pos = i;
break;
}
else Remove(i-1);
if (pos != -1) {
for (int i=pos+1;i<=q;++i) Remove(i-1);
Remove(pos-1);
}
if (p != x && p >= z) Remove(p-1);
--p;
}
Remove(t-1);
z = t + 1;
}
for (int i=1;i<=x;++i) Remove(i-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
1 ms |
508 KB |
Output is correct |
4 |
Correct |
1 ms |
520 KB |
Output is correct |
5 |
Correct |
2 ms |
524 KB |
Output is correct |
6 |
Correct |
0 ms |
512 KB |
Output is correct |
7 |
Correct |
1 ms |
520 KB |
Output is correct |
8 |
Correct |
1 ms |
520 KB |
Output is correct |
9 |
Correct |
1 ms |
572 KB |
Output is correct |
10 |
Correct |
1 ms |
520 KB |
Output is correct |
11 |
Correct |
0 ms |
520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
63 ms |
9720 KB |
Partially correct |
2 |
Partially correct |
63 ms |
9596 KB |
Partially correct |
3 |
Partially correct |
65 ms |
9596 KB |
Partially correct |
4 |
Partially correct |
63 ms |
9596 KB |
Partially correct |
5 |
Partially correct |
67 ms |
9564 KB |
Partially correct |
6 |
Partially correct |
68 ms |
9660 KB |
Partially correct |
7 |
Partially correct |
64 ms |
9680 KB |
Partially correct |
8 |
Partially correct |
65 ms |
9580 KB |
Partially correct |
9 |
Partially correct |
64 ms |
9704 KB |
Partially correct |
10 |
Partially correct |
65 ms |
9648 KB |
Partially correct |
11 |
Partially correct |
67 ms |
9580 KB |
Partially correct |
12 |
Partially correct |
68 ms |
9660 KB |
Partially correct |
13 |
Partially correct |
77 ms |
10252 KB |
Partially correct |
14 |
Partially correct |
69 ms |
9428 KB |
Partially correct |
15 |
Partially correct |
63 ms |
9596 KB |
Partially correct |
16 |
Partially correct |
69 ms |
9568 KB |
Partially correct |
17 |
Partially correct |
75 ms |
10360 KB |
Partially correct |
18 |
Partially correct |
74 ms |
10176 KB |
Partially correct |
19 |
Partially correct |
61 ms |
8544 KB |
Partially correct |
20 |
Partially correct |
64 ms |
9664 KB |
Partially correct |
21 |
Partially correct |
65 ms |
9872 KB |
Partially correct |
22 |
Partially correct |
78 ms |
10136 KB |
Partially correct |
23 |
Partially correct |
65 ms |
9604 KB |
Partially correct |
24 |
Partially correct |
63 ms |
9620 KB |
Partially correct |
25 |
Partially correct |
77 ms |
10172 KB |
Partially correct |
26 |
Partially correct |
79 ms |
10316 KB |
Partially correct |
27 |
Partially correct |
77 ms |
10164 KB |
Partially correct |
28 |
Partially correct |
81 ms |
10168 KB |
Partially correct |
29 |
Partially correct |
90 ms |
10168 KB |
Partially correct |
30 |
Partially correct |
79 ms |
10208 KB |
Partially correct |
31 |
Partially correct |
79 ms |
10220 KB |
Partially correct |
32 |
Partially correct |
79 ms |
9788 KB |
Partially correct |
33 |
Partially correct |
89 ms |
9764 KB |
Partially correct |