# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1071035 | ttamx | Ancient Machine (JOI21_ancient_machine) | C++17 | 41 ms | 9040 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,vector<char> s){
int seq=0,cnt=0,pw=1;
for(int i=0;i<n;i++){
seq+=pw*(s[i]-'X');
cnt++;
pw*=3;
if(cnt==5){
for(int j=0;j<8;j++){
Send(seq>>j&1);
}
seq=cnt=0;
pw=1;
}
}
if(cnt>0){
for(int j=0;j<8;j++){
Send(seq>>j&1);
}
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
void Bruno(int n,int m,vector<int> a){
vector<char> s;
for(int i=0;i<m;i+=8){
int seq=0;
for(int j=0;j<8;j++){
seq|=a[i+j]<<j;
}
for(int j=0;j<5;j++){
s.emplace_back('X'+seq%3);
seq/=3;
}
}
s.resize(n);
stack<int> st;
for(int i=0;i<n;i++){
if(s[i]=='X'){
if(st.empty()||s[st.top()]=='Y'){
st.emplace(i);
}else{
Remove(i);
}
}else if(s[i]=='Y'){
if(!s.empty()&&s[st.top()]=='X'){
st.emplace(i);
}else{
Remove(i);
}
}else{
while(st.size()>1){
Remove(st.top());
st.pop();
}
Remove(i);
}
}
while(!st.empty()){
Remove(st.top());
st.pop();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |