# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
574489 | Arvin | Ancient Machine (JOI21_ancient_machine) | C++17 | 97 ms | 10700 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
namespace {
int variable_example = 0;
}
void Anna(int N, std::vector<char> S) {
for(int x=0;x<N;x++){
if(S[x] == 'X'){
Send(1);
Send(0);
} else if(S[x] == 'Y'){
Send(0);
Send(1);
} else if(S[x] == 'Z'){
Send(1);
Send(1);
}
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
namespace {
int variable_example = 0;
int FunctionExample(int P) { return 1 - P; }
} // namespace
void Bruno(int N, int L, std::vector<int> A) {
// for (int i = 0; i < L; i++) {
// variable_example += FunctionExample(A[i]);
// }
int S[N];
for(int x=0;x<N;x++){
S[x] = 0;
for(int y=0;y<2;y++){
if(A[2*x+y] == 1){
S[x] += (1 << y);
}
}
}
int lst = N;
for(int x=N-1;x>=0;x--){
if(S[x] == 3){
lst = x;
break;
}
}
vector<int> ans;
vector<pair<int, int>> v;
int pos = -1;
for(int x=0;x<N;x++){
if(S[x] == 3){
while(!v.empty()){
if(pos != -1){
ans.push_back(pos);
}
ans.push_back(v.back().second);
pos = v.back().first;
v.pop_back();
}
ans.push_back(x);
} else if(S[x] == 2){
if(pos != -1){
v.push_back({pos, x});
pos = -1;
} else {
ans.push_back(x);
}
} else if(S[x] == 1){
if(pos != -1){
ans.push_back(pos);
}
pos = x;
}
}
while(!v.empty()){
ans.push_back(v.back().first);
ans.push_back(v.back().second);
v.pop_back();
}
if(pos != -1){
ans.push_back(pos);
pos = -1;
}
for(auto val : ans){
// cout << "- " << val << "\n";
Remove(val);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |