답안 #139845

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
139845 2019-08-01T14:24:26 Z zoooma13 도서관 (JOI18_library) C++14
100 / 100
570 ms 408 KB
#include "bits/stdc++.h"
#include "library.h"
using namespace std;

void Solve(int N)
{
    if(N == 1){
        Answer({1});
        return;
    }

    vector <int> still(N);
    iota(still.begin() ,still.end() ,0);

    int chnd;
    for(int i=0; i<N; i++){
        vector <int> M(N ,1);
        M[i] = 0;
        if(Query(M) == 1)
            chnd = i;
    }
    still.erase(find(still.begin() ,still.end() ,chnd));

    vector <int> res{chnd+1};
    for(int i=1; i<N; i++){
        int st = 0 ,en = still.size()-1 ,mid;
        while(st <= en){
            mid = (st+en)>>1;
            vector <int> M(N ,0);
            for(int i=0; i<=mid; i++)
                M[still[i]] = 1;
            int c = Query(M);
            M[chnd] = 1;
            if(c == Query(M))
                en = mid-1;
            else
                st = mid+1;
        }
        chnd = still[st];
        res.push_back(chnd+1);
        still.erase(still.begin()+st);
    }

	Answer(res);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 248 KB # of queries: 2586
2 Correct 32 ms 400 KB # of queries: 2555
3 Correct 54 ms 248 KB # of queries: 2716
4 Correct 39 ms 380 KB # of queries: 2728
5 Correct 34 ms 316 KB # of queries: 2714
6 Correct 55 ms 376 KB # of queries: 2712
7 Correct 35 ms 316 KB # of queries: 2718
8 Correct 33 ms 316 KB # of queries: 2611
9 Correct 49 ms 376 KB # of queries: 2713
10 Correct 28 ms 376 KB # of queries: 1597
11 Correct 2 ms 376 KB # of queries: 0
12 Correct 2 ms 248 KB # of queries: 4
13 Correct 2 ms 248 KB # of queries: 7
14 Correct 2 ms 248 KB # of queries: 14
15 Correct 3 ms 248 KB # of queries: 99
16 Correct 6 ms 248 KB # of queries: 205
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 248 KB # of queries: 2586
2 Correct 32 ms 400 KB # of queries: 2555
3 Correct 54 ms 248 KB # of queries: 2716
4 Correct 39 ms 380 KB # of queries: 2728
5 Correct 34 ms 316 KB # of queries: 2714
6 Correct 55 ms 376 KB # of queries: 2712
7 Correct 35 ms 316 KB # of queries: 2718
8 Correct 33 ms 316 KB # of queries: 2611
9 Correct 49 ms 376 KB # of queries: 2713
10 Correct 28 ms 376 KB # of queries: 1597
11 Correct 2 ms 376 KB # of queries: 0
12 Correct 2 ms 248 KB # of queries: 4
13 Correct 2 ms 248 KB # of queries: 7
14 Correct 2 ms 248 KB # of queries: 14
15 Correct 3 ms 248 KB # of queries: 99
16 Correct 6 ms 248 KB # of queries: 205
17 Correct 496 ms 376 KB # of queries: 18160
18 Correct 499 ms 248 KB # of queries: 17933
19 Correct 560 ms 248 KB # of queries: 18178
20 Correct 490 ms 248 KB # of queries: 16960
21 Correct 431 ms 324 KB # of queries: 15937
22 Correct 522 ms 296 KB # of queries: 18168
23 Correct 531 ms 320 KB # of queries: 18157
24 Correct 146 ms 320 KB # of queries: 8321
25 Correct 535 ms 376 KB # of queries: 17675
26 Correct 478 ms 404 KB # of queries: 16597
27 Correct 152 ms 320 KB # of queries: 8287
28 Correct 570 ms 408 KB # of queries: 18954
29 Correct 562 ms 248 KB # of queries: 18933
30 Correct 568 ms 376 KB # of queries: 18954