제출 #417218

#제출 시각아이디문제언어결과실행 시간메모리
417218tqbfjotldAncient Machine (JOI21_ancient_machine)C++17
70 / 100
79 ms8340 KiB
#include "Anna.h"
#include <vector>
using namespace std;

void Anna(int N, std::vector<char> S) {
    bool found = false;
    for (int x = 0; x<N; x++){
        if (S[x]=='X') found = true;
        Send((!found) || S[x]=='Z');
    }
}
#include "Bruno.h"
#include <vector>
#include <cassert>
using namespace std;


void Bruno(int N, int L, std::vector<int> A) {
    assert(L==N);
    int Xpos = -1;
    for (int x = 0; x<N; x++){
        if (!A[x]){
            Xpos = x;
            break;
        }
    }

    if (Xpos==-1){
        for (int x = 0; x<N; x++){
            Remove(x);
        }
        return;
    }
    vector<int> rem;
    for (int x = 0; x<Xpos; x++){
        Remove(x);
    }
    for (int x = Xpos+1; x<N; x++){
        if (A[x]){
            while (!rem.empty()){
                Remove(rem.back());
                rem.pop_back();
            }
            Remove(x);
        }
        else{
            rem.push_back(x);
        }
    }
    Remove(Xpos);
    for (auto x : rem){
        Remove(x);
    }
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...