Submission #1151160

#TimeUsernameProblemLanguageResultExecution timeMemory
1151160ShadowSharkAncient Machine (JOI21_ancient_machine)C++20
0 / 100
28 ms6336 KiB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

void Anna(int N, std::vector<char> S) {
    int firstX = -1;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'X') {
            firstX = i;
            break;
        }
    }

    for (int i = 1; i <= firstX; i++)
        Send(1);
    Send(0);

    int pre = firstX;
    for (int j = firstX + 1; j < N; j++) {
        if (S[j] == 'Z') {
            for (int k = 2; k <= j - pre; k++)
                Send(1);
            Send(0);
            pre = j;
        }
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>

void Bruno(int N, int L, std::vector<int> A) {
    bool mark[200005];
    memset(mark, false, sizeof mark);

    int firstX = 1;
    for (int i = 0; i < L; i++)
        if (A[i] == 1) firstX++;
            else break;

    int pre = firstX, cnt = 0;
    for (int j = firstX; j < L; j++) {
        if (A[j] == 1) cnt++;
            else {
                int nxt = pre + cnt + 1;
                for (int i = nxt - 1; i >= pre && !mark[i]; i--) {
                    Remove(i - 1);
                    mark[i] = true;
                }
                pre = nxt;
            }
    }

    for (int i = 1; i <= N; i++)
        if (!mark[i]) {
            mark[i] = true;
            Remove(i - 1);
        }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...