# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
574689 | Arvin | Ancient Machine (JOI21_ancient_machine) | C++17 | 78 ms | 8316 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) {
// 1 as store this first X or any Z after first Xa
// 0 otherwise
bool fX = false;
for(int x=0;x<N;x++){
if(S[x] == 'Z'){
Send(fX);
} else if(S[x] == 'Y'){ // XYXYZYZYZYZ (occurences of X are always first than Y)
Send(0);
} else if(S[x] == 'X'){
if(!fX){
Send(1);
fX = true;
} else {
Send(0);
}
}
}
}
#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]);
// }
assert(L <= N);
vector<int> ans;
int pos = -1, lst = 0;
for(int x=0;x<L;x++){
if(A[x] == 1){
if(pos == -1){
pos = x;
lst = x+1;
} else {
for(int y=x-1;y>=lst;y--){
ans.push_back(y);
}
ans.push_back(x);
lst = x+1;
}
}
}
for(int x=0;x<=pos;x++){
ans.push_back(x);
}
for(int x=lst;x<N;x++){
ans.push_back(x);
}
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... |