답안 #136966

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
136966 2019-07-26T17:35:18 Z Osama_Alkhodairy 도서관 (JOI18_library) C++17
0 / 100
476 ms 504 KB
#include <bits/stdc++.h>
#include "library.h"
//~ #include "grader.cpp"
using namespace std;

void Solve(int N){
    int start = 0;
    vector <int> ans;
    while(start < N){
        vector <int> q(N, 1);
        q[start] = 0;
        if(Query(q) == 1){
            ans.push_back(start);
            break;
        }
        start++;
    }
    vector <int> all;
    for(int i = 0 ; i < N ; i++){
        if(i != ans.back()) all.push_back(i);
    }
    while(all.size()){
        int l = 0, r = (int)all.size() - 1;
        while(l <= r){
            int mid = (l + r) / 2;
            vector <int> q(N, 0);
            for(int i = 0 ; i <= mid ; i++){
                q[all[i]] = 1;
            }
            int x = Query(q);
            q[ans.back()] = 1;
            if(Query(q) == x) r = mid - 1;
            else l = mid + 1;
        }
        ans.push_back(all[l]);
        swap(all[l], all.back());
        all.pop_back();
    }
    for(auto &i : ans) i++;
    Answer(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 404 KB # of queries: 2407
2 Correct 51 ms 376 KB # of queries: 2457
3 Correct 45 ms 376 KB # of queries: 2652
4 Correct 45 ms 248 KB # of queries: 2607
5 Correct 48 ms 248 KB # of queries: 2502
6 Correct 39 ms 376 KB # of queries: 2571
7 Correct 45 ms 376 KB # of queries: 2570
8 Correct 30 ms 316 KB # of queries: 2422
9 Correct 47 ms 248 KB # of queries: 2546
10 Correct 28 ms 376 KB # of queries: 1500
11 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 248 KB # of queries: 3
13 Correct 2 ms 248 KB # of queries: 6
14 Correct 2 ms 248 KB # of queries: 9
15 Correct 3 ms 376 KB # of queries: 81
16 Correct 5 ms 376 KB # of queries: 205
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 404 KB # of queries: 2407
2 Correct 51 ms 376 KB # of queries: 2457
3 Correct 45 ms 376 KB # of queries: 2652
4 Correct 45 ms 248 KB # of queries: 2607
5 Correct 48 ms 248 KB # of queries: 2502
6 Correct 39 ms 376 KB # of queries: 2571
7 Correct 45 ms 376 KB # of queries: 2570
8 Correct 30 ms 316 KB # of queries: 2422
9 Correct 47 ms 248 KB # of queries: 2546
10 Correct 28 ms 376 KB # of queries: 1500
11 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 248 KB # of queries: 3
13 Correct 2 ms 248 KB # of queries: 6
14 Correct 2 ms 248 KB # of queries: 9
15 Correct 3 ms 376 KB # of queries: 81
16 Correct 5 ms 376 KB # of queries: 205
17 Correct 475 ms 452 KB # of queries: 17994
18 Correct 453 ms 376 KB # of queries: 17215
19 Correct 463 ms 376 KB # of queries: 17545
20 Correct 449 ms 248 KB # of queries: 16317
21 Correct 398 ms 328 KB # of queries: 15330
22 Correct 467 ms 248 KB # of queries: 17669
23 Correct 453 ms 424 KB # of queries: 17224
24 Correct 160 ms 452 KB # of queries: 7923
25 Correct 465 ms 404 KB # of queries: 17106
26 Correct 418 ms 376 KB # of queries: 15995
27 Correct 173 ms 376 KB # of queries: 8020
28 Correct 476 ms 376 KB # of queries: 17547
29 Correct 421 ms 328 KB # of queries: 17557
30 Correct 474 ms 400 KB # of queries: 17547