# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
537700 | Jarif_Rahman | Ancient Machine (JOI21_ancient_machine) | C++17 | 91 ms | 9696 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
namespace {
}
void Anna(int n, vector<char> s){
for(int i = 0; i < n; i++){
if(s[i] == 'X') Send(0), Send(0);
else if(s[i] == 'Y') Send(0), Send(1);
else Send(1);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
namespace {
}
void Bruno(int n, int m, vector<int> A){
str s = "";
for(int i = 0; i < m; i++){
if(A[i] == 0){
if(A[i+1] == 0) s+="X";
else s+="Y";
i++;
}
else s+="Z";
}
list<pair<int, char>> ls;
for(int i = 0; i < n; i++) ls.pb({i, s[i]});
for(auto it = ls.begin(); it != ls.end();){
if(it == ls.begin() || prev(it)->sc != it->sc){
it++;
continue;
}
Remove(it->f);
it = ls.erase(it);
}
while(!ls.empty() && ls.begin()->sc != 'X')
Remove(ls.begin()->f), ls.erase(ls.begin());
while(!ls.empty() && prev(ls.end())->sc != 'Z')
Remove(prev(ls.end())->f), ls.erase(prev(ls.end()));
if(ls.empty()) return;
for(auto it = ls.begin(); it != ls.end();){
if(it->sc != 'Z'){
it++;
continue;
}
for(auto it2 = prev(it); it2 != ls.begin();)
Remove(it2->f), it2 = ls.erase(it2), it2--;
Remove(it->f);
it = ls.erase(it);
}
Remove(ls.begin()->f);
ls.erase(ls.begin());
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |