#include "Anna.h"
#include <vector>
using namespace std;
namespace {
int variable_example = 0;
}
void Anna(int N, vector<char> S){
int found=0;
for(auto i:S){
if(found==0){
if(i=='X')found=1;
Send(found);
}
else{
if(i=='Z')Send(1);
else Send(0);
}
}
}
/*
10
X Y X Y Z X Y Z Y Z
trying to solve in N
if we highlight all y and do it backward it might remove a z
but not an x between -xz
and wont remove x'z'yz
x yyyyyy xz yyyy z
we have to choose one
so the 2nd x will becomne uselss and the 2nd group of y
what if we remove all useless one first
then we will be left with
xyyyz xyyz xyyz
now can we just do from left to right
highlight first x and a pair of y->z
then we can get rid of useless one then remove left to right and save the first x for last
case:
x y x y z
x y z y z
**
we can split each z then for each block do right to left but we do block left to right
we will also highlight 1 x
for case like x z y z
then we just need to remove everything so the left of the comp is x
will this work??
**
*/
#include "Bruno.h"
#include<iostream>
#include<cassert>
#include <vector>
using namespace std;
namespace {
int variable_example = 0;
int FunctionExample(int P) { return 1 - P; }
}
void Bruno(int N, int L,vector<int> A){
int found=0,x=-1;
vector<int>done(N,0);
for(int i=0;i<L;i++){
if(A[i]){
int cur=i-1;
while(!A[cur]&&cur>=0){
if(done[cur])break;
Remove(cur);
done[cur]=1;
cur--;
}
if(found&&!done[i]){
//if(done[i])assert(0);
Remove(i),done[i]=1;
}
else x=i;
}
found|=A[i];
}
if(x!=-1)Remove(x),done[x]=1;
for(int i=0;i<N;i++)if(!done[i])Remove(i);
}
Compilation message
Anna.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
6 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
Bruno.cpp:10:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
10 | int FunctionExample(int P) { return 1 - P; }
| ^~~~~~~~~~~~~~~
Bruno.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
8 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
796 KB |
Output is correct |
2 |
Correct |
0 ms |
796 KB |
Output is correct |
3 |
Correct |
0 ms |
784 KB |
Output is correct |
4 |
Correct |
0 ms |
796 KB |
Output is correct |
5 |
Correct |
0 ms |
796 KB |
Output is correct |
6 |
Correct |
0 ms |
788 KB |
Output is correct |
7 |
Correct |
0 ms |
784 KB |
Output is correct |
8 |
Correct |
0 ms |
784 KB |
Output is correct |
9 |
Correct |
0 ms |
796 KB |
Output is correct |
10 |
Correct |
0 ms |
796 KB |
Output is correct |
11 |
Correct |
1 ms |
748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
36 ms |
8540 KB |
Partially correct |
2 |
Partially correct |
34 ms |
8660 KB |
Partially correct |
3 |
Partially correct |
35 ms |
8460 KB |
Partially correct |
4 |
Partially correct |
38 ms |
8584 KB |
Partially correct |
5 |
Partially correct |
34 ms |
8520 KB |
Partially correct |
6 |
Partially correct |
34 ms |
8612 KB |
Partially correct |
7 |
Partially correct |
34 ms |
8608 KB |
Partially correct |
8 |
Partially correct |
34 ms |
8472 KB |
Partially correct |
9 |
Partially correct |
37 ms |
8608 KB |
Partially correct |
10 |
Partially correct |
37 ms |
8588 KB |
Partially correct |
11 |
Partially correct |
34 ms |
8492 KB |
Partially correct |
12 |
Partially correct |
34 ms |
8592 KB |
Partially correct |
13 |
Partially correct |
42 ms |
8404 KB |
Partially correct |
14 |
Partially correct |
43 ms |
8784 KB |
Partially correct |
15 |
Partially correct |
34 ms |
8568 KB |
Partially correct |
16 |
Partially correct |
36 ms |
8556 KB |
Partially correct |
17 |
Partially correct |
44 ms |
8552 KB |
Partially correct |
18 |
Partially correct |
42 ms |
8384 KB |
Partially correct |
19 |
Partially correct |
41 ms |
8500 KB |
Partially correct |
20 |
Partially correct |
34 ms |
8556 KB |
Partially correct |
21 |
Partially correct |
35 ms |
8596 KB |
Partially correct |
22 |
Partially correct |
41 ms |
8528 KB |
Partially correct |
23 |
Partially correct |
37 ms |
8552 KB |
Partially correct |
24 |
Partially correct |
34 ms |
8564 KB |
Partially correct |
25 |
Partially correct |
43 ms |
8540 KB |
Partially correct |
26 |
Partially correct |
49 ms |
8548 KB |
Partially correct |
27 |
Partially correct |
41 ms |
8584 KB |
Partially correct |
28 |
Partially correct |
41 ms |
8424 KB |
Partially correct |
29 |
Partially correct |
41 ms |
8484 KB |
Partially correct |
30 |
Partially correct |
43 ms |
8588 KB |
Partially correct |
31 |
Partially correct |
41 ms |
8560 KB |
Partially correct |
32 |
Partially correct |
34 ms |
8592 KB |
Partially correct |
33 |
Partially correct |
34 ms |
8600 KB |
Partially correct |