Submission #712601

#TimeUsernameProblemLanguageResultExecution timeMemory
712601tht2005Ancient Machine (JOI21_ancient_machine)C++17
30 / 100
92 ms10236 KiB
#include "Anna.h"
#include <vector>

void Anna(int N, std::vector<char> S) {
    for(int i = 0; i < N; ++i) {
        if(S[i] == 'X') {
            Send(0);
        }
        else if(S[i] == 'Y') {
            Send(0);
        }
        else {
            Send(1);
        }
    }
    for(int i = 0; i < N; ++i) {
        if(S[i] == 'X') {
            Send(0);
        }
        else if(S[i] == 'Y') {
            Send(1);
        }
        else {
            Send(0);
        }
    }
}
#include "Bruno.h"
#include <vector>

void Bruno(int N, int L, std::vector<int> A) {
    std::vector<int> S(N);
    for(int i = 0; i < N; ++i) {
        S[i] = (A[i] << 1) | A[N + i];
    }
    int first_X = 0;
    while(first_X < N && S[first_X] > 0) {
        ++first_X;
    }
    std::vector<int> stk;
    for(int i = 0; i < first_X; ++i) {
        Remove(i);
    }
    for(int i = first_X; i < N; ++i) {
        if(S[i] == 1) {
            while(!stk.empty() && S[stk.back()] > 0) {
                Remove(stk.back());
                stk.pop_back();
            }
        }
        else if(S[i] == 2) {
            while(!stk.empty() && first_X < stk.back()) {
                Remove(stk.back());
                stk.pop_back();
            }
        }
        stk.push_back(i);
    }
    for(int i : stk) {
        Remove(i);
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...