Submission #1151150

#TimeUsernameProblemLanguageResultExecution timeMemory
1151150anmattroiAncient Machine (JOI21_ancient_machine)C++17
70 / 100
42 ms6456 KiB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

void Anna(int N, vector<char> S) {
    int p = -1;
    for (int i = 0; i < N; i++) {
        if (p == -1) {
            if (S[i] == 'X') {
                p = i;
                Send(1);
                continue;
            }
            Send(0);
            continue;
        }
        if (S[i] == 'Z') Send(1);
        else Send(0);
    }
}

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

using namespace std;


void Bruno(int N, int L, vector<int> A) {
    int cnt = 0;
    for (int i = 0; i < N; i++) cnt += A[i];
    if (cnt <= 1) {
        for (int i = N-1; i >= 0; i--) Remove(i);
        return;
    }
    int p = -1;
    for (int i = 0; i < N; i++)
        if (A[i] == 1) {
            p = i;
            break;
        }

    int nho = p;

    for (int i = 0; i < p; i++) Remove(i);
    for (int i = p+1; i < N; i++)
        if (A[i]) {
            for (int j = i-1; j > p; j--) Remove(j);
            Remove(i);
            p = i;
        }
    for (int i = p+1; i < N; i++) Remove(i);
    Remove(nho);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...