Submission #260330

# Submission time Handle Problem Language Result Execution time Memory
260330 2020-08-10T05:40:59 Z 반딧불(#5056) Library (JOI18_library) C++17
100 / 100
613 ms 504 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;

int n;
int arr[1002];
bool used[1002];

void Solve(int N){
    n = N;
    if(n==1){
        Answer({1});
        return;
    }
    for(int i=0; i<n; i++){ /// findFirst
        vector<int> v (n, 1);
        v[i] = 0;
        if(Query(v) == 1){
            arr[0] = i;
            used[i] = 1;
            break;
        }
    }

    for(int i=1; i<n; i++){
        vector<int> v;
        for(int j=0; j<n; j++) if(!used[j]) v.push_back(j);

        while(v.size() > 1){
            int vs = (int)v.size();
            int vsh = vs / 2;
            vector<int> tv (v.begin(), v.begin() + vsh);

            vector<int> queryV (n, 0);
            for(auto &x: tv) queryV[x] = 1;
            int q1 = Query(queryV);
            queryV[arr[i-1]] = 1;
            int q2 = Query(queryV);

            if(q2 == q1) v = tv;
            else v = vector<int> (v.begin() + vsh, v.end());
        }

        arr[i] = v[0];
        used[v[0]] = 1;
    }

    vector<int> ret (arr, arr+n);
    for(auto &x: ret) x++;
    Answer(ret);
}
# Verdict Execution time Memory Grader output
1 Correct 49 ms 256 KB # of queries: 2375
2 Correct 48 ms 256 KB # of queries: 2409
3 Correct 41 ms 256 KB # of queries: 2648
4 Correct 46 ms 256 KB # of queries: 2595
5 Correct 59 ms 256 KB # of queries: 2508
6 Correct 30 ms 372 KB # of queries: 2551
7 Correct 30 ms 372 KB # of queries: 2544
8 Correct 32 ms 372 KB # of queries: 2420
9 Correct 55 ms 256 KB # of queries: 2546
10 Correct 21 ms 288 KB # of queries: 1474
11 Correct 0 ms 256 KB # of queries: 0
12 Correct 0 ms 256 KB # of queries: 1
13 Correct 1 ms 256 KB # of queries: 4
14 Correct 1 ms 256 KB # of queries: 7
15 Correct 1 ms 256 KB # of queries: 77
16 Correct 4 ms 256 KB # of queries: 183
# Verdict Execution time Memory Grader output
1 Correct 49 ms 256 KB # of queries: 2375
2 Correct 48 ms 256 KB # of queries: 2409
3 Correct 41 ms 256 KB # of queries: 2648
4 Correct 46 ms 256 KB # of queries: 2595
5 Correct 59 ms 256 KB # of queries: 2508
6 Correct 30 ms 372 KB # of queries: 2551
7 Correct 30 ms 372 KB # of queries: 2544
8 Correct 32 ms 372 KB # of queries: 2420
9 Correct 55 ms 256 KB # of queries: 2546
10 Correct 21 ms 288 KB # of queries: 1474
11 Correct 0 ms 256 KB # of queries: 0
12 Correct 0 ms 256 KB # of queries: 1
13 Correct 1 ms 256 KB # of queries: 4
14 Correct 1 ms 256 KB # of queries: 7
15 Correct 1 ms 256 KB # of queries: 77
16 Correct 4 ms 256 KB # of queries: 183
17 Correct 458 ms 256 KB # of queries: 17982
18 Correct 421 ms 376 KB # of queries: 17293
19 Correct 523 ms 504 KB # of queries: 17467
20 Correct 449 ms 384 KB # of queries: 16325
21 Correct 442 ms 376 KB # of queries: 15324
22 Correct 613 ms 368 KB # of queries: 17669
23 Correct 520 ms 384 KB # of queries: 17224
24 Correct 149 ms 384 KB # of queries: 7915
25 Correct 479 ms 384 KB # of queries: 17136
26 Correct 465 ms 376 KB # of queries: 15963
27 Correct 178 ms 256 KB # of queries: 8040
28 Correct 491 ms 384 KB # of queries: 15957
29 Correct 462 ms 384 KB # of queries: 15939
30 Correct 559 ms 384 KB # of queries: 15957