Submission #804427

# Submission time Handle Problem Language Result Execution time Memory
804427 2023-08-03T08:40:29 Z vjudge1 Library (JOI18_library) C++17
0 / 100
74 ms 208 KB
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home

#include <bits/stdc++.h>
#include <library.h>

using namespace std;

typedef long long ll;
typedef long double ld;

void Solve(int N) {
    srand(time(0));
    vector < int > M(N);
    deque < int > dq;
    vector < int > books(N);
    iota(books.begin(), books.end(), 1);
    random_shuffle(books.begin(), books.end());
    dq.push_back(books.back());
    bool ok = true;
    for(; ok;) {
        ok = false;
        M[dq.back()] = 1;
        for(int i = 0; i < (int)books.size(); ++ i) {
            M[books[i]] = 1;
            int ans = Query(M);
            M[books[i]] = 0;
            if(ans == 1) {
                dq.push_back(books[i]);
                books.erase(books.begin() + i);
                ok = true;
                break;
            }
        }
        M[dq.back()] = 0;
    }
    for(ok = true; ok;) {
        ok = false;
        M[dq.front()] = 1;
        for(int i = 0; i < (int)books.size(); ++ i) {
            M[books[i]] = 1;
            int ans = Query(M);
            M[books[i]] = 0;
            if(ans == 1) {
                dq.push_front(books[i]);
                books.erase(books.begin() + i);
                ok = true;
                break;
            }
        }
        M[dq.front()] = 0;
    }
    vector < int > res;
    for(auto &i : dq) {
        res.push_back(i);
    }
    Answer(res);
}

# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 208 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 208 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -