# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
260344 |
2020-08-10T06:16:42 Z |
문홍윤(#5075) |
Library (JOI18_library) |
C++17 |
|
47 ms |
384 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;
qu[i]=1;
}
}
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:17:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
384 KB |
# of queries: 2387 |
2 |
Correct |
41 ms |
256 KB |
# of queries: 2433 |
3 |
Correct |
47 ms |
256 KB |
# of queries: 2638 |
4 |
Correct |
46 ms |
256 KB |
# of queries: 2593 |
5 |
Correct |
38 ms |
256 KB |
# of queries: 2504 |
6 |
Correct |
41 ms |
256 KB |
# of queries: 2553 |
7 |
Correct |
35 ms |
256 KB |
# of queries: 2568 |
8 |
Correct |
41 ms |
256 KB |
# of queries: 2402 |
9 |
Correct |
41 ms |
256 KB |
# of queries: 2512 |
10 |
Correct |
25 ms |
384 KB |
# of queries: 1478 |
11 |
Incorrect |
0 ms |
256 KB |
Wrong Answer [2] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
384 KB |
# of queries: 2387 |
2 |
Correct |
41 ms |
256 KB |
# of queries: 2433 |
3 |
Correct |
47 ms |
256 KB |
# of queries: 2638 |
4 |
Correct |
46 ms |
256 KB |
# of queries: 2593 |
5 |
Correct |
38 ms |
256 KB |
# of queries: 2504 |
6 |
Correct |
41 ms |
256 KB |
# of queries: 2553 |
7 |
Correct |
35 ms |
256 KB |
# of queries: 2568 |
8 |
Correct |
41 ms |
256 KB |
# of queries: 2402 |
9 |
Correct |
41 ms |
256 KB |
# of queries: 2512 |
10 |
Correct |
25 ms |
384 KB |
# of queries: 1478 |
11 |
Incorrect |
0 ms |
256 KB |
Wrong Answer [2] |
12 |
Halted |
0 ms |
0 KB |
- |