Submission #139844

# Submission time Handle Problem Language Result Execution time Memory
139844 2019-08-01T14:23:10 Z zoooma13 Library (JOI18_library) C++14
0 / 100
547 ms 508 KB
#include "bits/stdc++.h"
#include "library.h"
using namespace std;

void Solve(int N)
{
    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);
}
# Verdict Execution time Memory Grader output
1 Correct 45 ms 248 KB # of queries: 2586
2 Correct 45 ms 248 KB # of queries: 2555
3 Correct 48 ms 504 KB # of queries: 2716
4 Correct 55 ms 376 KB # of queries: 2728
5 Correct 48 ms 376 KB # of queries: 2714
6 Correct 47 ms 376 KB # of queries: 2712
7 Correct 53 ms 376 KB # of queries: 2718
8 Correct 45 ms 248 KB # of queries: 2611
9 Correct 53 ms 376 KB # of queries: 2713
10 Correct 29 ms 260 KB # of queries: 1597
11 Runtime error 2 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 248 KB # of queries: 4
13 Correct 2 ms 248 KB # of queries: 7
14 Correct 2 ms 276 KB # of queries: 14
15 Correct 4 ms 248 KB # of queries: 99
16 Correct 4 ms 376 KB # of queries: 205
# Verdict Execution time Memory Grader output
1 Correct 45 ms 248 KB # of queries: 2586
2 Correct 45 ms 248 KB # of queries: 2555
3 Correct 48 ms 504 KB # of queries: 2716
4 Correct 55 ms 376 KB # of queries: 2728
5 Correct 48 ms 376 KB # of queries: 2714
6 Correct 47 ms 376 KB # of queries: 2712
7 Correct 53 ms 376 KB # of queries: 2718
8 Correct 45 ms 248 KB # of queries: 2611
9 Correct 53 ms 376 KB # of queries: 2713
10 Correct 29 ms 260 KB # of queries: 1597
11 Runtime error 2 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 248 KB # of queries: 4
13 Correct 2 ms 248 KB # of queries: 7
14 Correct 2 ms 276 KB # of queries: 14
15 Correct 4 ms 248 KB # of queries: 99
16 Correct 4 ms 376 KB # of queries: 205
17 Correct 534 ms 376 KB # of queries: 18160
18 Correct 516 ms 376 KB # of queries: 17933
19 Correct 487 ms 248 KB # of queries: 18178
20 Correct 493 ms 320 KB # of queries: 16960
21 Correct 450 ms 248 KB # of queries: 15937
22 Correct 519 ms 424 KB # of queries: 18168
23 Correct 544 ms 248 KB # of queries: 18157
24 Correct 153 ms 436 KB # of queries: 8321
25 Correct 511 ms 248 KB # of queries: 17675
26 Correct 443 ms 320 KB # of queries: 16597
27 Correct 180 ms 248 KB # of queries: 8287
28 Correct 547 ms 252 KB # of queries: 18954
29 Correct 539 ms 380 KB # of queries: 18933
30 Correct 544 ms 424 KB # of queries: 18954