# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078622 | 8pete8 | Ancient Machine (JOI21_ancient_machine) | C++17 | 30 ms | 8240 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |