#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);
}
}
}
/*
5
X Y X 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 <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=0;
for(int i=0;i<L;i++){
if(A[i]){
int cur=i-1;
while(!A[cur]&&cur>=0){
Remove(cur);
cur--;
}
if(found)Remove(i);
else x=i;
}
found|=A[i];
}
Remove(x);
}
Compilation message
Anna.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
6 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
Bruno.cpp:8:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
8 | int FunctionExample(int P) { return 1 - P; }
| ^~~~~~~~~~~~~~~
Bruno.cpp:6:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
6 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
784 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
8240 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |