# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
664249 | blue | Ancient Machine (JOI21_ancient_machine) | C++17 | 74 ms | 8728 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 <bits/stdc++.h>
namespace
{
using namespace std;
using vi = vector<int>;
}
void Anna(int N, vector<char> S)
{
// cerr << "hello\n";
int fx = 0;
int lz = N-1;
while(fx < N && S[fx] != 'X')
fx++;
while(lz >= 0 && S[lz] != 'Z')
lz--;
if(fx == N || lz == -1)
{
// cerr << "hello2\n";
return;
}
vi tosend(N+1, 0);
tosend[fx] = 1;
tosend[lz+1] = 1;
for(int i = fx+2; i <= lz-1; i++)
{
if(S[i-1] == 'Z' && S[i] == 'Y')
tosend[i] = 1;
}
// for(int i = 0; i <= N; i++)
// cerr << tosend[i];
// cerr << '\n';
for(int f : tosend)
Send(f);
}
#include "Bruno.h"
#include <bits/stdc++.h>
namespace
{
using namespace std;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pii>;
}
void Bruno(int N, int L, vi A)
{
if(A.empty())
{
for(int i = 0; i < N; i++)
Remove(i);
return;
}
int lz = N;
while(A[lz] != 1)
lz--;
lz--;
int fx = 0;
while(A[fx] != 1)
fx++;
// cerr << fx << ' ' << lz << '\n';
for(int i = 0; i < fx; i++)
Remove(i);
for(int i = lz+1; i < N; i++)
Remove(i);
vi st;
for(int i = fx+1; i <= lz; i++)
{
if(i < lz && A[i+1] == 0)
{
// cerr << "add " << i << " to stack\n";
st.push_back(i);
}
else
{
while(!st.empty())
{
Remove(st.back());
// cerr << "pop " << st.back() << '\n';
st.pop_back();
}
Remove(i);
// cerr << "remove Z : " << i << '\n';
}
}
Remove(fx);
// cerr << "final remove " << fx << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |