Submission #1153741

#TimeUsernameProblemLanguageResultExecution timeMemory
1153741sunflowerAncient Machine (JOI21_ancient_machine)C++17
0 / 100
15 ms1468 KiB
#ifndef SUN
#include "Anna.h"
#endif // SUN

#include <bits/stdc++.h>
using namespace std;

#define MASK(x) (1LL << (x))
#define BIT(x, i) (((x) >> (i)) & 1)

template <class X, class Y>
    bool maximize(X &x, Y y) {
        if (x < y) return x = y, true;
        else return false;
    }

void Anna(int n, std::vector <char> s) {
    string str = "";
    int firstX = -1;
    for (int i = 0; i < (int) s.size(); ++i) {
        if (s[i] == 'X') {
            if (firstX == -1) {
                firstX = i;
                str += '1';
            } else str += '0';
        } else {
            if (firstX == -1) str += '0';
            else {
                if (s[i] == 'Z' && (i == (int) s.size() - 1 || (i + 1 < (int) s.size() && s[i] != s[i + 1]))) str += '1';
                else str += '0';
            }
        }
    }

    for (char c : str) Send(c - '0');
}
#ifndef SUN
#include "Bruno.h"
#endif // SUN

#include <bits/stdc++.h>
using namespace std;

#define MASK(x) (1LL << (x))
#define BIT(x, i) (((x) >> (i)) & 1)

template <class X, class Y>
    bool maximize(X &x, Y y) {
        if (x < y) return x = y, true;
        else return false;
    }

void Bruno(int n, int L, std::vector <int> A) {
    int firstOne = -1;
    vector <bool> used(n + 2, false);
    for (int i = 0; i < (int) A.size(); ++i) {
        if (A[i] == 1) {
            if (firstOne == -1) firstOne = i;
            else {
                for (int j = i - 1; j > firstOne; --j) {
                    if (used[j]) break;
                    Remove(j);
                    used[j] = true;
                }
                Remove(i);
            }
        }
    }

    if (firstOne == -1) {
        for (int i = 1; i <= n; ++i) Remove(i);
    } else {
        Remove(firstOne);
    }
}

#ifdef SUN
int main() {
    cout << "ok";
}
#endif // SUN
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...