Submission #893278

# Submission time Handle Problem Language Result Execution time Memory
893278 2023-12-26T20:15:14 Z box Library (JOI18_library) C++17
0 / 100
0 ms 356 KB
#include <bits/stdc++.h>
using namespace std;

#define ar array
#define sz(v) int(std::size(v))
using i64 = long long;

#include "library.h"

void Solve(int N) {
    vector<int> v = {1};
    for (int x = 2; x <= N; x++) {
        int z = -1;
        for (int y = x; y <= N; y++) {
            v.push_back(y);
            if (Query(v) == 1) {
                z = y;
                break;
            } else v.pop_back();
        }
        assert(~z);
        v.pop_back();
        if (x == 2) v.push_back(z);
        else {
            int y = v.back();
            v.pop_back();
            v.push_back(z);
            if (Query(v)) {
                v.pop_back();
                v.push_back(y);
                v.insert(begin(v), z);
            } else {
                v.pop_back();
                v.push_back(y);
                v.push_back(z);
            }
        }
    }
    Answer(v);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 356 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 356 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -