Submission #1071151

# Submission time Handle Problem Language Result Execution time Memory
1071151 2024-08-23T05:18:12 Z thinknoexit Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
39 ms 8936 KB
#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

namespace {
    int n;
}
void Anna(int N, vector<char> S) {
    n = N;
    for (int i = 0;i < n;i++) {
        int v = S[i] - 'X';
        Send(!!(v & 1));
        Send(!!(v & 2));
    }
}
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

namespace {
    int n;
    int a[100100];
}  // namespace
void Bruno(int N, int L, vector<int> A) {
    n = N;
    for (int i = 0;i < n;i++) {
        a[i] = A[2 * i] + 2 * A[2 * i + 1];
    }
    stack<int> x, z;
    for (int i = n - 1;i >= 0;i--) if (a[i] == 2) z.push(i);
    for (int i = 0;i < n;i++) {
        while (!z.empty() && z.top() <= i) z.pop();
        if (a[i] == 0) x.push(i);
        else if (a[i] == 1) {
            if (x.empty() || z.empty()) {
                Remove(i);
                continue;
            }
            int l = x.top(), r = z.top();
            x.pop(), z.pop();
            for (int j = i + 1;j < r;j++) Remove(j);
            Remove(i);
            Remove(l), Remove(r);
            i = r;
        }
    }
    while (!x.empty()) {
        Remove(x.top());
        x.pop();
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1032 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 8936 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -