Submission #725039

# Submission time Handle Problem Language Result Execution time Memory
725039 2023-04-16T13:52:28 Z piOOE Ancient Machine (JOI21_ancient_machine) C++17
40 / 100
93 ms 9056 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 += 5) {
        int x = 0;
        for (int j = i; j < min(n, i + 5); ++j) {
            x = x * 3 + (s[j] == 'X' ? 0 : s[j] == 'Y' ? 1 : 2);
        }
        for (int _ = 0; (i + 5 >= n ? x : _ < 8); ++_) {
            Send(x % 2);
            x /= 2;
        }
    }
}
#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');
    int si = 0;
    for (int i = 0; i < L; i += 8, si += 5) {
        int x = 0;
        for (int j = i; j < min(L, i + 8); ++j) {
            x += (A[j]) << (j - i);
        }
        for (int sj = min(N, si + 5) - 1; sj >= si; --sj) {
            s[sj] = x % 3 == 0 ? 'X' : x % 3 == 1 ? 'Y' : 'Z';
            x /= 3;
        }
    }

    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') {
            stk.push_back(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 Correct 0 ms 516 KB Output is correct
2 Correct 0 ms 512 KB Output is correct
3 Correct 0 ms 508 KB Output is correct
4 Correct 0 ms 516 KB Output is correct
5 Correct 0 ms 516 KB Output is correct
6 Correct 0 ms 508 KB Output is correct
7 Correct 0 ms 508 KB Output is correct
8 Correct 1 ms 516 KB Output is correct
9 Correct 0 ms 508 KB Output is correct
10 Correct 1 ms 516 KB Output is correct
11 Correct 0 ms 516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 64 ms 8668 KB Partially correct
2 Partially correct 62 ms 8668 KB Partially correct
3 Partially correct 69 ms 8668 KB Partially correct
4 Partially correct 62 ms 8724 KB Partially correct
5 Partially correct 62 ms 8580 KB Partially correct
6 Partially correct 74 ms 8664 KB Partially correct
7 Partially correct 63 ms 8668 KB Partially correct
8 Partially correct 66 ms 8648 KB Partially correct
9 Partially correct 62 ms 8696 KB Partially correct
10 Partially correct 69 ms 8724 KB Partially correct
11 Partially correct 64 ms 8688 KB Partially correct
12 Partially correct 68 ms 8616 KB Partially correct
13 Partially correct 93 ms 8988 KB Partially correct
14 Partially correct 70 ms 8644 KB Partially correct
15 Partially correct 69 ms 8668 KB Partially correct
16 Partially correct 71 ms 8600 KB Partially correct
17 Partially correct 81 ms 9056 KB Partially correct
18 Partially correct 69 ms 8764 KB Partially correct
19 Partially correct 69 ms 8668 KB Partially correct
20 Partially correct 68 ms 8772 KB Partially correct
21 Partially correct 68 ms 8672 KB Partially correct
22 Partially correct 72 ms 8656 KB Partially correct
23 Partially correct 64 ms 8664 KB Partially correct
24 Partially correct 64 ms 8612 KB Partially correct
25 Partially correct 78 ms 8684 KB Partially correct
26 Partially correct 78 ms 8576 KB Partially correct
27 Partially correct 71 ms 8688 KB Partially correct
28 Partially correct 72 ms 8592 KB Partially correct
29 Partially correct 70 ms 8572 KB Partially correct
30 Partially correct 81 ms 8644 KB Partially correct
31 Partially correct 87 ms 8600 KB Partially correct
32 Partially correct 64 ms 8676 KB Partially correct
33 Partially correct 82 ms 8624 KB Partially correct