#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
namespace {
int variable_example = 0;
}
void Anna(int N, std::vector<char> S) {
// vector<int> ans;
// vector<pair<int, int>> v;
// int pos = -1;
// for(int x=0;x<N;x++){
// if(S[x] == 'Z'){
// while(!v.empty()){
// if(pos != -1){
// ans.push_back(pos);
// }
//
// ans.push_back(v.back().second);
// pos = v.back().first;
//
// v.pop_back();
// }
// ans.push_back(x);
// } else if(S[x] == 'Y'){
// if(pos != -1){
// v.push_back({pos, x});
// pos = -1;
// } else {
// ans.push_back(x);
// }
// } else if(S[x] == 'X'){
// if(pos != -1){
// ans.push_back(x);
// } else {
// pos = x;
// }
// }
// }
//
// while(!v.empty()){
// ans.push_back(v.back().first);
// ans.push_back(v.back().second);
// v.pop_back();
// }
// if(pos != -1){
// ans.push_back(pos);
// pos = -1;
// }
for(int x=0;x<N;x++){
if(S[x] == 'X'){
Send(1);
Send(0);
} else if(S[x] == 'Y'){
Send(0);
Send(1);
} else if(S[x] == 'Z'){
Send(1);
Send(1);
}
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
namespace {
int variable_example = 0;
int FunctionExample(int P) { return 1 - P; }
} // namespace
void Bruno(int N, int L, std::vector<int> A) {
// for (int i = 0; i < L; i++) {
// variable_example += FunctionExample(A[i]);
// }
int S[N];
for(int x=0;x<N;x++){
S[x] = 0;
for(int y=0;y<2;y++){
if(A[2*x+y] == 1){
S[x] += (1 << y);
}
}
}
int lst = N;
for(int x=N-1;x>=0;x--){
if(S[x] == 3){
lst = x;
break;
}
}
vector<int> ans;
vector<pair<int, int>> v;
int pos = -1;
for(int x=0;x<N;x++){
if(S[x] == 3){
while(!v.empty()){
if(pos != -1){
ans.push_back(pos);
}
ans.push_back(v.back().second);
pos = v.back().first;
v.pop_back();
}
ans.push_back(x);
} else if(S[x] == 2){
if(pos != -1){
v.push_back({pos, x});
pos = -1;
} else {
ans.push_back(x);
}
} else if(S[x] == 1){
if(pos != -1){
ans.push_back(x);
} else {
pos = x;
}
}
}
while(!v.empty()){
ans.push_back(v.back().first);
ans.push_back(v.back().second);
v.pop_back();
}
if(pos != -1){
ans.push_back(pos);
pos = -1;
}
for(auto val : ans){
// cout << "- " << val << "\n";
Remove(val);
}
}
Compilation message
Anna.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
10 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:30:6: warning: variable 'lst' set but not used [-Wunused-but-set-variable]
30 | int lst = N;
| ^~~
Bruno.cpp: At global scope:
Bruno.cpp:12:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
12 | int FunctionExample(int P) { return 1 - P; }
| ^~~~~~~~~~~~~~~
Bruno.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
10 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
536 KB |
Output is correct |
2 |
Correct |
0 ms |
508 KB |
Output is correct |
3 |
Correct |
0 ms |
480 KB |
Output is correct |
4 |
Correct |
1 ms |
516 KB |
Output is correct |
5 |
Correct |
0 ms |
508 KB |
Output is correct |
6 |
Correct |
1 ms |
516 KB |
Output is correct |
7 |
Correct |
0 ms |
508 KB |
Output is correct |
8 |
Correct |
1 ms |
592 KB |
Output is correct |
9 |
Correct |
0 ms |
508 KB |
Output is correct |
10 |
Correct |
0 ms |
512 KB |
Output is correct |
11 |
Correct |
0 ms |
516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
80 ms |
9752 KB |
Partially correct |
2 |
Partially correct |
78 ms |
9760 KB |
Partially correct |
3 |
Partially correct |
79 ms |
9864 KB |
Partially correct |
4 |
Partially correct |
75 ms |
9752 KB |
Partially correct |
5 |
Partially correct |
71 ms |
9836 KB |
Partially correct |
6 |
Partially correct |
87 ms |
9736 KB |
Partially correct |
7 |
Partially correct |
77 ms |
9760 KB |
Partially correct |
8 |
Partially correct |
73 ms |
9760 KB |
Partially correct |
9 |
Partially correct |
84 ms |
9780 KB |
Partially correct |
10 |
Partially correct |
68 ms |
9828 KB |
Partially correct |
11 |
Partially correct |
102 ms |
9924 KB |
Partially correct |
12 |
Partially correct |
75 ms |
9804 KB |
Partially correct |
13 |
Partially correct |
77 ms |
10284 KB |
Partially correct |
14 |
Partially correct |
76 ms |
9772 KB |
Partially correct |
15 |
Partially correct |
90 ms |
9788 KB |
Partially correct |
16 |
Partially correct |
69 ms |
9784 KB |
Partially correct |
17 |
Partially correct |
81 ms |
9828 KB |
Partially correct |
18 |
Partially correct |
84 ms |
9788 KB |
Partially correct |
19 |
Partially correct |
79 ms |
9788 KB |
Partially correct |
20 |
Partially correct |
68 ms |
9924 KB |
Partially correct |
21 |
Partially correct |
66 ms |
9800 KB |
Partially correct |
22 |
Partially correct |
76 ms |
9792 KB |
Partially correct |
23 |
Partially correct |
73 ms |
9844 KB |
Partially correct |
24 |
Partially correct |
65 ms |
9848 KB |
Partially correct |
25 |
Partially correct |
75 ms |
9796 KB |
Partially correct |
26 |
Partially correct |
87 ms |
9784 KB |
Partially correct |
27 |
Partially correct |
83 ms |
9756 KB |
Partially correct |
28 |
Partially correct |
77 ms |
9716 KB |
Partially correct |
29 |
Partially correct |
82 ms |
9904 KB |
Partially correct |
30 |
Partially correct |
83 ms |
9808 KB |
Partially correct |
31 |
Partially correct |
74 ms |
9880 KB |
Partially correct |
32 |
Partially correct |
67 ms |
9788 KB |
Partially correct |
33 |
Partially correct |
84 ms |
9820 KB |
Partially correct |