Submission #684405

# Submission time Handle Problem Language Result Execution time Memory
684405 2023-01-21T06:09:06 Z mjhmjh1104 Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
48 ms 7692 KB
#include "Anna.h"
#include <vector>
using namespace std;

void Anna(int n, vector<char> s) {
    int k = 0;
    bool skip = false;
    for (int i = 0; i < n; i++) {
        if (skip) skip = false;
        else if (s[i] == 'X') Send(1), skip = true;
        else Send(0);
        if (s[i] == 'Z') k = i;
    }
    for (int t = 0; t <= 16; t++) Send(k & 1 << t ? 1 : 0);
}
#include "Bruno.h"
#include <vector>
using namespace std;

void Bruno(int n, int l, vector<int> b) {
    int lt = n, rt = 0;
    vector<int> a;
    for (int i = 0; i < (int)b.size() - 17; i++) {
        if (b[i]) a.push_back(1), a.push_back(0);
        else a.push_back(0);
    }
    for (int i = (int)b.size() - 17; i < (int)b.size(); i++) a.push_back(b[i]);
    for (int t = 0; t <= 16; t++) if (a[n + t]) rt |= 1 << t;
    for (int i = n - 1; i >= 0; i--) if (a[i] || !i) {
        for (int j = i + 1; j < lt; j++) if (a[j]) Remove(j);
        for (int j = i + 1; j < lt; j++) if (!a[j] && j != rt) Remove(j);
        if (i != rt) Remove(i);
        lt = i;
    }
    Remove(rt);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 516 KB Output is correct
2 Correct 1 ms 508 KB Output is correct
3 Correct 0 ms 508 KB Output is correct
4 Incorrect 0 ms 508 KB Wrong Answer [3]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 46 ms 7692 KB Partially correct
2 Incorrect 48 ms 7528 KB Wrong Answer [6]
3 Halted 0 ms 0 KB -