답안 #642142

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642142 2022-09-18T15:00:01 Z skittles1412 Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
53 ms 8080 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 520 KB Output is correct
2 Correct 0 ms 644 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 520 KB Output is correct
5 Incorrect 0 ms 520 KB Wrong Answer [6]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 8080 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -