# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
930852 | boris_mihov | Ancient Machine (JOI21_ancient_machine) | C++17 | 47 ms | 8688 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>
void Anna(int N, std::vector <char> s)
{
bool foundX = false;
for (int i = 0 ; i < N ; ++i)
{
if (!foundX && s[i] == 'X')
{
foundX = true;
Send(1);
} else if (foundX && s[i] == 'Z')
{
Send(1);
} else
{
Send(0);
}
}
}
#include "Bruno.h"
#include <vector>
void Bruno(int N, int L, std::vector <int> A)
{
int xPos = -1;
std::vector <int> pos;
for (int i = 0 ; i < N ; ++i)
{
if (A[i] == 1)
{
if (xPos == -1) xPos = i;
pos.push_back(i);
}
}
if (pos.empty())
{
for (int i = 0 ; i < N ; ++i)
{
Remove(i);
}
return;
}
if (pos.back() < N - 1) pos.push_back(N - 1);
for (int i = 0 ; i < xPos ; ++i)
{
Remove(i);
}
for (int i = 1 ; i < pos.size() ; ++i)
{
for (int j = pos[i] - 1 ; j > pos[i - 1] ; --j)
{
Remove(j);
}
Remove(pos[i]);
}
Remove(pos[0]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |