# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
417308 | errorgorn | Ancient Machine (JOI21_ancient_machine) | C++17 | 98 ms | 10832 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;
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
namespace {
int n;
vector<char> s;
}
void Anna(int N, std::vector<char> S) {
n=N;
s=S;
rep(x,0,n){
if (s[x]=='X') Send(0),Send(0);
if (s[x]=='Y') Send(0),Send(1);
if (s[x]=='Z') Send(1),Send(0);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define endl '\n'
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
namespace {
int n,l;
vector<int> bits;
string s;
} // namespace
void Bruno(int N, int L, std::vector<int> A) {
n=N,l=L,bits=A;
rep(x,0,n){
if (bits[2*x]==0 && bits[2*x+1]==0) s+='X';
if (bits[2*x]==0 && bits[2*x+1]==1) s+='Y';
if (bits[2*x]==1 && bits[2*x+1]==0) s+='Z';
}
vector<int> stk;
rep(x,0,n){
if (s[x]=='X'){
if (sz(stk)%2==0) stk.pub(x);
else Remove(x);
}
else if (s[x]=='Y'){
if (sz(stk)%2==1) stk.pub(x);
else Remove(x);
}
else{
while (sz(stk)>1){
Remove(stk.back());
stk.pob();
}
Remove(x);
}
}
while (!stk.empty()){
Remove(stk.back());
stk.pob();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |