Submission #798486

#TimeUsernameProblemLanguageResultExecution timeMemory
798486fatemetmhrAncient Machine (JOI21_ancient_machine)C++17
70 / 100
48 ms8352 KiB

#include "Anna.h"

#include <bits/stdc++.h>

//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

void Anna(int n, std::vector<char> s) {
    bool found = false;
    for(int i = 0; i < n; i++){
        if(s[i] == 'X'){
            Send(found);
            found = true;
        }
        if(s[i] == 'Y'){
            Send(1);
        }
        if(s[i] == 'Z'){
            Send(found ^ 1);
        }
    }
}
//  ~ Be Name Khoda ~  //

#include "Bruno.h"
#include <bits/stdc++.h>

//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second


void Bruno(int n, int l, std::vector<int> a){
    vector <int> av, have;
    int found = -1;
    for(int i = 0; i < n; i++){
        if(a[i])
            av.pb(i);
        else if(found == -1){
            found = i;
            av.pb(i);
        }
        else{
            while(av.size() && av.back() != found){
                Remove(av.back());
                av.pop_back();
            }
            Remove(i);
        }
    }
    while(av.size()){
        Remove(av.back());
        av.pop_back();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...