# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
882395 | willychan | Ancient Machine (JOI21_ancient_machine) | C++17 | 60 ms | 10484 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>
namespace {
int variable_example = 0;
}
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 <vector>
#include<bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
int FunctionExample(int P) { return 1 - P; }
} // namespace
void Bruno(int N, int L, std::vector<int> A) {
vector<int> arr(N);
for(int i=0;i<N;i++){
int c = 2*A[2*i] + A[2*i+1];
arr[i]=c;
}
queue<int> z;
vector<bool> taken(N,0);
vector<tuple<int,int,int> > dostuff;
for(int i=0;i<N;i++){
if(arr[i]==2) z.push(i);
}
stack<int> x;
for(int i=0;i<N;i++){
if(arr[i]==0){
x.push(i);
continue;
}
if(arr[i]==1){
while(x.size() && x.top()>i) x.pop();
while(z.size() && z.front()<i) z.pop();
if(x.size() && z.size()){
taken[x.top()]=1;
taken[z.front()]=1;
taken[i]=1;
dostuff.push_back({x.top(),i,z.front()});
x.pop();
z.pop();
}
}
}
for(int i=0;i<N;i++) if(!taken[i]) Remove(i);
for(auto i : dostuff){
Remove(get<1>(i));
Remove(get<0>(i));
Remove(get<2>(i));
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |