Submission #919332

# Submission time Handle Problem Language Result Execution time Memory
919332 2024-01-31T15:18:01 Z ttamx Library (JOI18_library) C++14
100 / 100
287 ms 596 KB
#include <bits/stdc++.h>
#include "library.h"

using namespace std;

void Solve(int n){
	vector<int> a(n);
	iota(a.begin(),a.end(),0);
	auto del=[&](int x){
		a.erase(a.begin()+x);
	};
	vector<int> qr(n,1);
	int st=0;
	for(int i=1;i<n;i++){
		qr[i]=0;
		if(Query(qr)==1){
			st=i;
			break;
		}
		qr[i]=1;
	}
	del(st);
	vector<int> ans{st};
	for(int t=1;t<n;t++){
		int l=0,r=a.size()-1;
		while(l<r){
			int m=(l+r)/2;
			qr.assign(n,0);
			for(int i=0;i<=m;i++)qr[a[i]]=1;
			int res=Query(qr);
			qr[ans.back()]=1;
			if(Query(qr)==res)r=m;
			else l=m+1;
		}
		ans.emplace_back(a[l]);
		del(l);
	}
	for(auto &x:ans)x++;
	Answer(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 23 ms 432 KB # of queries: 2386
2 Correct 21 ms 596 KB # of queries: 2432
3 Correct 24 ms 432 KB # of queries: 2637
4 Correct 25 ms 432 KB # of queries: 2592
5 Correct 27 ms 436 KB # of queries: 2503
6 Correct 26 ms 440 KB # of queries: 2552
7 Correct 27 ms 436 KB # of queries: 2567
8 Correct 24 ms 436 KB # of queries: 2401
9 Correct 25 ms 436 KB # of queries: 2511
10 Correct 13 ms 432 KB # of queries: 1477
11 Correct 0 ms 344 KB # of queries: 0
12 Correct 0 ms 344 KB # of queries: 1
13 Correct 1 ms 344 KB # of queries: 3
14 Correct 1 ms 344 KB # of queries: 9
15 Correct 1 ms 344 KB # of queries: 79
16 Correct 2 ms 512 KB # of queries: 186
# Verdict Execution time Memory Grader output
1 Correct 23 ms 432 KB # of queries: 2386
2 Correct 21 ms 596 KB # of queries: 2432
3 Correct 24 ms 432 KB # of queries: 2637
4 Correct 25 ms 432 KB # of queries: 2592
5 Correct 27 ms 436 KB # of queries: 2503
6 Correct 26 ms 440 KB # of queries: 2552
7 Correct 27 ms 436 KB # of queries: 2567
8 Correct 24 ms 436 KB # of queries: 2401
9 Correct 25 ms 436 KB # of queries: 2511
10 Correct 13 ms 432 KB # of queries: 1477
11 Correct 0 ms 344 KB # of queries: 0
12 Correct 0 ms 344 KB # of queries: 1
13 Correct 1 ms 344 KB # of queries: 3
14 Correct 1 ms 344 KB # of queries: 9
15 Correct 1 ms 344 KB # of queries: 79
16 Correct 2 ms 512 KB # of queries: 186
17 Correct 287 ms 424 KB # of queries: 18007
18 Correct 269 ms 420 KB # of queries: 17230
19 Correct 273 ms 424 KB # of queries: 17450
20 Correct 254 ms 420 KB # of queries: 16276
21 Correct 246 ms 420 KB # of queries: 15361
22 Correct 272 ms 424 KB # of queries: 17616
23 Correct 266 ms 424 KB # of queries: 17169
24 Correct 97 ms 416 KB # of queries: 7884
25 Correct 274 ms 424 KB # of queries: 17117
26 Correct 256 ms 424 KB # of queries: 15988
27 Correct 98 ms 504 KB # of queries: 7993
28 Correct 267 ms 428 KB # of queries: 16955
29 Correct 281 ms 420 KB # of queries: 16936
30 Correct 263 ms 424 KB # of queries: 16955