Submission #725034

# Submission time Handle Problem Language Result Execution time Memory
725034 2023-04-16T13:38:29 Z piOOE Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
80 ms 9120 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

void Anna(int n, std::vector<char> s) {
    for (int i = 0; i < n; ++i) {
        Send(s[i] == 'Y');
    }
    for (int i = 0; i < n; ++i) {
        Send(s[i] == 'Z');
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

void Bruno(int N, int L, std::vector<int> A) {
    vector<char> s(N, 'X');

    for (int i = 0; i < N; ++i) {
        if (A[i]) {
            s[i] = 'Y';
        }
    }
    for (int i = N; i < 2 * N; ++i) {
        if (A[i]) {
            s[i - N] = 'Z';
        }
    }

    vector<int> stk;
    int xy = 0;

    for (int i = 0; i < N; ++i) {
        if (s[i] == 'Y') {
            if (!stk.empty() && s[stk.back()] == 'X') {
                stk.push_back(i);
                xy += 1;
            } else {
                Remove(i);
            }
        } else if (s[i] == 'X') {
            if (!stk.empty() && s[stk.back()] != 'X') {
                stk.push_back(i);
            } else {
                Remove(i);
            }
        } else {
            while (stk.size() > 1) {
                Remove(stk.back());
                stk.pop_back();
            }
            Remove(i);
            xy = 0;
        }
    }
    for (int x : stk) {
        Remove(x);
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 508 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 9120 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -