Submission #804466

# Submission time Handle Problem Language Result Execution time Memory
804466 2023-08-03T08:53:24 Z vjudge1 Library (JOI18_library) C++17
Compilation error
0 ms 0 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(), 0);
    
    random_shuffle(books.begin(), books.end());

    dq.push_back(books.back());
    books.pop_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 + 1);
    }
    Answer(res);
}

main() {
    Solve(5);
}

Compilation message

library.cpp:67:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   67 | main() {
      | ^~~~
/usr/bin/ld: /tmp/ccUYGQlh.o: in function `main':
library.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccylViFf.o:grader.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status