답안 #266667

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
266667 2020-08-15T12:06:20 Z Toirov_Sadi 도서관 (JOI18_library) C++17
19 / 100
369 ms 384 KB
#include<bits/stdc++.h>
#include "library.h"

using namespace std;

void Solve(int N){
    vector<int> res;
    res = {1};
    set<int> p;
    for(int i = 2; i <= N; i ++) p.insert(i);

    vector<int> q(N, 0);
    auto fll = [&](vector<int> &t){
        int good = 1;
        while(good == 1){
            int last = res.back();
            int nxt = -1;
            good = 0;
            for(auto x: p){
                if(good == 1) break;
                q[last - 1] = 1;
                q[x - 1] = 1;
                if(Query(q) == 1){
                    nxt = x;
                    good = 1;
                }
                q[last - 1] = 0;
                q[x - 1] = 0;
            }
            if(good == 1){
                p.erase(nxt);
                res.push_back(nxt);
            }
        }
    };
    fll(res);
    reverse(res.begin(), res.end());
    fll(res);

    Answer(res);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 158 ms 384 KB # of queries: 9820
2 Correct 124 ms 376 KB # of queries: 8651
3 Correct 131 ms 384 KB # of queries: 9011
4 Correct 157 ms 256 KB # of queries: 10227
5 Correct 142 ms 384 KB # of queries: 9915
6 Correct 130 ms 256 KB # of queries: 9269
7 Correct 153 ms 384 KB # of queries: 9742
8 Correct 134 ms 384 KB # of queries: 9697
9 Correct 167 ms 256 KB # of queries: 9792
10 Correct 58 ms 384 KB # of queries: 4359
11 Correct 0 ms 256 KB # of queries: 0
12 Correct 1 ms 256 KB # of queries: 1
13 Correct 0 ms 256 KB # of queries: 3
14 Correct 0 ms 256 KB # of queries: 4
15 Correct 2 ms 256 KB # of queries: 75
16 Correct 4 ms 256 KB # of queries: 193
# 결과 실행 시간 메모리 Grader output
1 Correct 158 ms 384 KB # of queries: 9820
2 Correct 124 ms 376 KB # of queries: 8651
3 Correct 131 ms 384 KB # of queries: 9011
4 Correct 157 ms 256 KB # of queries: 10227
5 Correct 142 ms 384 KB # of queries: 9915
6 Correct 130 ms 256 KB # of queries: 9269
7 Correct 153 ms 384 KB # of queries: 9742
8 Correct 134 ms 384 KB # of queries: 9697
9 Correct 167 ms 256 KB # of queries: 9792
10 Correct 58 ms 384 KB # of queries: 4359
11 Correct 0 ms 256 KB # of queries: 0
12 Correct 1 ms 256 KB # of queries: 1
13 Correct 0 ms 256 KB # of queries: 3
14 Correct 0 ms 256 KB # of queries: 4
15 Correct 2 ms 256 KB # of queries: 75
16 Correct 4 ms 256 KB # of queries: 193
17 Incorrect 369 ms 384 KB Wrong Answer [3]
18 Halted 0 ms 0 KB -