제출 #642142

#제출 시각아이디문제언어결과실행 시간메모리
642142skittles1412Ancient Machine (JOI21_ancient_machine)C++17
0 / 100
53 ms8080 KiB
#include "bits/extc++.h"

using namespace std;

template <typename T>
void dbgh(const T& t) {
    cerr << t << endl;
}

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t << " | ";
    dbgh(u...);
}

#ifdef DEBUG
#define dbg(...)                                           \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]" \
         << ": ";                                          \
    dbgh(__VA_ARGS__)
#else
#define cerr   \
    if (false) \
    cerr
#define dbg(...)
#endif

#define endl "\n"
#define long int64_t
#define sz(x) int(std::size(x))

void Send(int a);

void Anna(int n, vector<char> arr) {
    int i = 0;
    auto send_until = [&](char c) -> void {
        while (i < n) {
            if (arr[i++] == c) {
                Send(1);
                break;
            } else {
                Send(0);
            }
        }
    };
    send_until('X');
    while (i < n) {
        send_until('Y');
        send_until('Z');
    }
}
#include "bits/extc++.h"

using namespace std;

template <typename T>
void dbgh(const T& t) {
    cerr << t << endl;
}

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t << " | ";
    dbgh(u...);
}

#ifdef DEBUG
#define dbg(...)                                           \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]" \
         << ": ";                                          \
    dbgh(__VA_ARGS__)
#else
#define cerr   \
    if (false) \
    cerr
#define dbg(...)
#endif

#define endl "\n"
#define long int64_t
#define sz(x) int(std::size(x))

void Remove(int d);

void Bruno(int n, int, vector<int> arr) {
    int i = 0;
    auto rm = [&](int x) -> void {
        if (x != -1) {
            Remove(x);
        }
    };
    auto read_until = [&]() -> int {
        while (i < n) {
            if (arr[i]) {
                return i++;
            }
            rm(i++);
        }
        return -1;
    };
    int cx = read_until();
    while (i < n) {
        int cy = read_until(), cz = read_until();
        rm(cy);
        rm(cz);
    }
    rm(cx);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...