답안 #101135

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101135 2019-03-17T02:31:18 Z TAISA_ 도서관 (JOI18_library) C++14
0 / 100
532 ms 408 KB
#include<bits/stdc++.h>
#include "library.h"
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll MOD=1000000007LL;
const ll INF=(1<<30);
const ll LINF=(1LL<<60);
template<typename T> void chmax(T &a,T b){a=max(a,b);}
template<typename T> void chmin(T &a,T b){a=min(a,b);} 
void Solve(int N){
	int pos;
	vector<int> vis(N+10);
	for(int i=1;i<=N;i++){
		vector<int> v(N);
		for(int j=1;j<=N;j++){
			if(i==j)continue;
			v[j-1]=1;
		}
		int q=Query(v);
		if(q==1){
			pos=i;
			vis[pos]=1;
			break;
		}
	}
	vector<int> ans;
	ans.push_back(pos);
	for(int i=0;i<N-1;i++){
		vector<int> v,vv(N);
		for(int j=1;j<=N;j++){
			if(vis[j])continue;
			v.push_back(j);
		}
		sort(all(v));
		int ng=0,ok=v.size();
		while(ok-ng>1){
			int mid=(ok+ng)/2;
			for(int j=0;j<N;j++)vv[j]=0;
			for(int j=0;j<mid;j++)vv[v[j]-1]=1;
			int q1=Query(vv);
			vv[pos-1]=1;
			int q2=Query(vv);
			if(q1==q2){
				ok=mid;
			}else{
				ng=mid;
			}
		}
		pos=v[ok-1];
		vis[pos]=1;
		ans.push_back(pos);
	}
	Answer(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 384 KB # of queries: 2375
2 Correct 40 ms 384 KB # of queries: 2409
3 Correct 46 ms 256 KB # of queries: 2648
4 Correct 51 ms 384 KB # of queries: 2595
5 Correct 24 ms 324 KB # of queries: 2508
6 Correct 49 ms 384 KB # of queries: 2551
7 Correct 29 ms 408 KB # of queries: 2544
8 Correct 40 ms 256 KB # of queries: 2420
9 Correct 41 ms 256 KB # of queries: 2546
10 Correct 16 ms 324 KB # of queries: 1474
11 Incorrect 2 ms 384 KB Wrong Answer [2]
12 Correct 2 ms 384 KB # of queries: 1
13 Correct 2 ms 256 KB # of queries: 4
14 Correct 2 ms 256 KB # of queries: 7
15 Correct 3 ms 384 KB # of queries: 77
16 Correct 6 ms 384 KB # of queries: 183
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 384 KB # of queries: 2375
2 Correct 40 ms 384 KB # of queries: 2409
3 Correct 46 ms 256 KB # of queries: 2648
4 Correct 51 ms 384 KB # of queries: 2595
5 Correct 24 ms 324 KB # of queries: 2508
6 Correct 49 ms 384 KB # of queries: 2551
7 Correct 29 ms 408 KB # of queries: 2544
8 Correct 40 ms 256 KB # of queries: 2420
9 Correct 41 ms 256 KB # of queries: 2546
10 Correct 16 ms 324 KB # of queries: 1474
11 Incorrect 2 ms 384 KB Wrong Answer [2]
12 Correct 2 ms 384 KB # of queries: 1
13 Correct 2 ms 256 KB # of queries: 4
14 Correct 2 ms 256 KB # of queries: 7
15 Correct 3 ms 384 KB # of queries: 77
16 Correct 6 ms 384 KB # of queries: 183
17 Correct 487 ms 404 KB # of queries: 17982
18 Correct 494 ms 256 KB # of queries: 17293
19 Correct 441 ms 336 KB # of queries: 17467
20 Correct 407 ms 384 KB # of queries: 16325
21 Correct 459 ms 256 KB # of queries: 15324
22 Correct 455 ms 376 KB # of queries: 17669
23 Correct 532 ms 384 KB # of queries: 17224
24 Correct 153 ms 408 KB # of queries: 7915
25 Correct 412 ms 256 KB # of queries: 17136
26 Correct 353 ms 256 KB # of queries: 15963
27 Correct 136 ms 256 KB # of queries: 8040
28 Correct 383 ms 256 KB # of queries: 15957
29 Correct 402 ms 384 KB # of queries: 15939
30 Correct 479 ms 256 KB # of queries: 15957