Submission #260343

# Submission time Handle Problem Language Result Execution time Memory
260343 2020-08-10T06:14:53 Z 문홍윤(#5075) Library (JOI18_library) C++17
0 / 100
28 ms 376 KB
#include "library.h"
#include <bits/stdc++.h>
#define eb emplace_back
using namespace std;

int n;
vector<int> ret, qu;

int get_side(){
    for(int i=0; i<n; i++)qu[i]=1;
    for(int i=0; i<n; i++){
        qu[i]=0;
        int tmp=Query(qu);
        if(tmp==1)return i;
    }
}

int ch[1010];
vector<int> vc;
vector<int> did;

int get_dnc(int s, int e){
    if(s==e)return vc[s];
    int mid=(s+e)/2;
    for(int i=s; i<=mid; i++)qu[vc[i]]=1;
    int tmp1=Query(qu);
    for(auto i:did)qu[i]=1;
    int tmp2=Query(qu);
    for(auto i:did)qu[i]=0;
    for(int i=s; i<=mid; i++)qu[vc[i]]=0;
    if(tmp1==tmp2)return get_dnc(s, mid);
    return get_dnc(mid+1, e);
}

int get_nxt(){
    vc.clear();
    for(int i=0; i<n; i++){
        if(!ch[i])vc.eb(i);
    }
    return get_dnc(0, vc.size()-1);
}

void Solve(int N){
    n=N;
    ret.resize(n);
    qu.resize(n);
    if(n==1){
        ret[0]=1;
        Answer(ret);
    }
	int rt=get_side();
	for(int i=0; i<n; i++)qu[i]=0;
	ret[0]=rt+1;
	ch[rt]=1;
	did.eb(rt);
	for(int i=1; i<n; i++){
        int tmp=get_nxt();
        ret[i]=tmp+1;
        ch[tmp]=1;
        did.eb(tmp);
	}
	Answer(ret);
}

Compilation message

library.cpp: In function 'int get_side()':
library.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 376 KB Wrong Answer [8]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 376 KB Wrong Answer [8]
2 Halted 0 ms 0 KB -