# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1071041 | 12345678 | Ancient Machine (JOI21_ancient_machine) | C++17 | 71 ms | 9660 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>
using namespace std;
void Anna(int N, std::vector<char> S) {
for (int i=0; i<N; i++)
{
if (S[i]=='X') Send(0), Send(0);
if (S[i]=='Y') Send(0), Send(1);
if (S[i]=='Z') Send(1), Send(0);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=1e5+5;
int t[nx], curx=-1;
void Bruno(int N, int L, std::vector<int> A) {
for (int i = 0; i < N; i++) t[i]=A[2*i]*2+A[2*i+1];
stack<pair<int, int>> s;
for (int i=0; i<N; i++)
{
if (t[i]==0)
{
if (curx==-1) curx=i;
else Remove(i);
}
if (t[i]==1)
{
//cout<<"curx "<<curx<<'\n';
if (curx!=-1) s.push({curx, i}), curx=-1;
else Remove(i);
}
if (t[i]==2)
{
if (!s.empty())
{
if (curx!=-1) Remove(curx);
while (!s.empty())
{
Remove(s.top().second);
if (s.size()==1) curx=s.top().first;
else Remove(s.top().first);
s.pop();
}
}
Remove(i);
}
}
if (curx!=-1) Remove(curx);
while (!s.empty()) Remove(s.top().first), Remove(s.top().second), s.pop();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |