답안 #490934

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
490934 2021-11-29T22:17:32 Z ETK 도서관 (JOI18_library) C++14
100 / 100
445 ms 576 KB
//GOODTEK!!!
#include "library.h"
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define pii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define ll long long
using namespace std;
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
    while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
    return x*f;
}
int n;
int ask(vi vec,int w=0){
    vi que(n);
    for(int x:vec)que[x-1]=1;
    if(w)que[w-1]=1;
    return Query(que);
}
void Solve(int N){
    n=N;
    vi p(n);
    for(int i=0;i<n;i++)p[i]=i+1;
    random_shuffle(ALL(p));
    rep(i,1,n-1){
        swap(p[0],p[i]);
        if(i==n-1||ask(vi(p.begin()+1,p.end()))==1)break;
    }
    rep(i,0,n-2){
        auto l=p.begin()+i+1,r=p.end();
        while(l+1!=r){
            auto mid=l+(r-l)/2;
            if(ask(vi(l,mid))==ask(vi(l,mid),p[i]))r=mid;
            else l=mid;
        }
        swap(p[i+1],*l);
    }
    Answer(p);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 200 KB # of queries: 2422
2 Correct 32 ms 200 KB # of queries: 2407
3 Correct 41 ms 292 KB # of queries: 2565
4 Correct 36 ms 200 KB # of queries: 2576
5 Correct 38 ms 200 KB # of queries: 2525
6 Correct 38 ms 296 KB # of queries: 2658
7 Correct 33 ms 200 KB # of queries: 2604
8 Correct 34 ms 200 KB # of queries: 2412
9 Correct 36 ms 328 KB # of queries: 2489
10 Correct 21 ms 288 KB # of queries: 1506
11 Correct 0 ms 200 KB # of queries: 0
12 Correct 0 ms 200 KB # of queries: 0
13 Correct 0 ms 200 KB # of queries: 3
14 Correct 0 ms 200 KB # of queries: 7
15 Correct 2 ms 200 KB # of queries: 81
16 Correct 3 ms 200 KB # of queries: 205
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 200 KB # of queries: 2422
2 Correct 32 ms 200 KB # of queries: 2407
3 Correct 41 ms 292 KB # of queries: 2565
4 Correct 36 ms 200 KB # of queries: 2576
5 Correct 38 ms 200 KB # of queries: 2525
6 Correct 38 ms 296 KB # of queries: 2658
7 Correct 33 ms 200 KB # of queries: 2604
8 Correct 34 ms 200 KB # of queries: 2412
9 Correct 36 ms 328 KB # of queries: 2489
10 Correct 21 ms 288 KB # of queries: 1506
11 Correct 0 ms 200 KB # of queries: 0
12 Correct 0 ms 200 KB # of queries: 0
13 Correct 0 ms 200 KB # of queries: 3
14 Correct 0 ms 200 KB # of queries: 7
15 Correct 2 ms 200 KB # of queries: 81
16 Correct 3 ms 200 KB # of queries: 205
17 Correct 424 ms 432 KB # of queries: 17170
18 Correct 418 ms 344 KB # of queries: 17437
19 Correct 436 ms 448 KB # of queries: 18020
20 Correct 373 ms 576 KB # of queries: 16398
21 Correct 298 ms 352 KB # of queries: 15192
22 Correct 445 ms 328 KB # of queries: 17351
23 Correct 397 ms 340 KB # of queries: 17664
24 Correct 140 ms 308 KB # of queries: 7899
25 Correct 408 ms 568 KB # of queries: 17107
26 Correct 377 ms 548 KB # of queries: 16283
27 Correct 145 ms 300 KB # of queries: 7874
28 Correct 402 ms 552 KB # of queries: 17486
29 Correct 419 ms 308 KB # of queries: 17417
30 Correct 419 ms 320 KB # of queries: 17486