#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
}
void Anna(int N, std::vector<char> S) {
for (auto u : S) {
if (u == 'X') Send (0), Send (0);
else if (u == 'Y') Send (0), Send(1);
else Send (1), Send(0);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
void Bruno(int N, int L, std::vector<int> A) {
string s;
int n = N;
for (int i=0; i<2*n; i+=2) {
if (A[i] == 0 && A[i+1] == 0) s.push_back('X');
else if (A[i] == 0 && A[i+1] == 1) s.push_back('Y');
else s.push_back('Z');
}
int l = -1, r = -1;
for (int i=0; i<n; i++) {
if (s[i] == 'X') {
l = i;
break;
}
}
for (int i=n-1; i>=0; i--) {
if (s[i] == 'Z') {
r = i;
break;
}
}
// cout << s << ' ' << l << ' ' << r << '\n';
if (l == -1 || r == -1) {
for (int i=0; i<n; i++) Remove(i);
return;
}
for (int i=0; i<l; i++) Remove(i);
for (int i=r+1; i<n; i++) Remove(i);
stack<int> st;
st.push(l);
for (int i=l+1; i<=r; i++) {
int u = st.top();
if (s[i] == s[u]) {
Remove(i);
continue;
}
if (s[i] == 'Z') {
while (st.size() > 1) {
int u = st.top();
Remove(u);
st.pop();
}
Remove(i);
}
else st.push(i);
}
while (st.size()) {
int u = st.top();
Remove(u);
st.pop();
}
}
Compilation message
Anna.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
6 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
508 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
1 ms |
512 KB |
Output is correct |
4 |
Correct |
1 ms |
512 KB |
Output is correct |
5 |
Correct |
1 ms |
608 KB |
Output is correct |
6 |
Correct |
1 ms |
520 KB |
Output is correct |
7 |
Correct |
1 ms |
520 KB |
Output is correct |
8 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [4] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
70 ms |
9152 KB |
Partially correct |
2 |
Partially correct |
80 ms |
9600 KB |
Partially correct |
3 |
Partially correct |
70 ms |
9712 KB |
Partially correct |
4 |
Partially correct |
73 ms |
9636 KB |
Partially correct |
5 |
Partially correct |
81 ms |
9468 KB |
Partially correct |
6 |
Partially correct |
73 ms |
9492 KB |
Partially correct |
7 |
Partially correct |
72 ms |
9580 KB |
Partially correct |
8 |
Partially correct |
68 ms |
9536 KB |
Partially correct |
9 |
Partially correct |
79 ms |
9440 KB |
Partially correct |
10 |
Partially correct |
80 ms |
9612 KB |
Partially correct |
11 |
Partially correct |
78 ms |
9540 KB |
Partially correct |
12 |
Partially correct |
70 ms |
9548 KB |
Partially correct |
13 |
Partially correct |
77 ms |
9564 KB |
Partially correct |
14 |
Partially correct |
90 ms |
9544 KB |
Partially correct |
15 |
Partially correct |
80 ms |
9568 KB |
Partially correct |
16 |
Partially correct |
68 ms |
9492 KB |
Partially correct |
17 |
Partially correct |
74 ms |
9512 KB |
Partially correct |
18 |
Partially correct |
84 ms |
9544 KB |
Partially correct |
19 |
Partially correct |
80 ms |
9572 KB |
Partially correct |
20 |
Partially correct |
69 ms |
9608 KB |
Partially correct |
21 |
Partially correct |
69 ms |
9584 KB |
Partially correct |
22 |
Partially correct |
79 ms |
9496 KB |
Partially correct |
23 |
Partially correct |
68 ms |
9560 KB |
Partially correct |
24 |
Partially correct |
67 ms |
9564 KB |
Partially correct |
25 |
Partially correct |
81 ms |
9576 KB |
Partially correct |
26 |
Partially correct |
78 ms |
9524 KB |
Partially correct |
27 |
Incorrect |
85 ms |
9516 KB |
Wrong Answer [4] |
28 |
Halted |
0 ms |
0 KB |
- |