답안 #436128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
436128 2021-06-24T09:12:56 Z AmineTrabelsi 도서관 (JOI18_library) C++14
0 / 100
197 ms 200 KB
#include <cstdio>
#include <bits/stdc++.h>
#include "library.h"
using namespace std;

void Solve(int N){
	vector<int> M(N);
	vector<int> res(N);
	deque<int> curr;
	curr.push_back(1);
	M[0] = 1;
	for(int i=1;i<N;i++){
		M[i] = 1;
		int q = Query(M);
		if(q == 1){
			curr.push_back(i+1);
			break;
		}
		M[i] = 0;
	}
	/*
	for(auto i:curr)cerr << i<<" ";
		cerr<<'\n';
	*/
	int cnt = N-2;
	while(cnt--){
		int ind = 0;
		for(int i=1;i<N;i++){
			if(M[i] != 1){
				M[i] = 1;
				int q = Query(M);
				if(q == 1){
					ind = i;
					break;
				}
				M[i] = 0;
			}
		}
		//cout << ind << "\n";
		M[curr.back()-1] = 0;
		int q = Query(M);
		M[curr.back()-1] = 1;
		if(q == 2){
			curr.push_back(ind+1);
		}else curr.push_front(ind+1);
	}/*
	for(auto i:curr)cerr << i<<" ";
		cerr<<'\n';
		*/
	res = vector<int>(curr.begin(),curr.end());
	Answer(res);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 200 KB # of queries: 8884
2 Correct 144 ms 200 KB # of queries: 8522
3 Correct 184 ms 200 KB # of queries: 8998
4 Correct 134 ms 200 KB # of queries: 9859
5 Correct 173 ms 200 KB # of queries: 10046
6 Correct 156 ms 200 KB # of queries: 9415
7 Correct 128 ms 200 KB # of queries: 9868
8 Correct 197 ms 200 KB # of queries: 9922
9 Correct 187 ms 200 KB # of queries: 9823
10 Correct 73 ms 200 KB # of queries: 4097
11 Runtime error 1 ms 200 KB Execution killed with signal 13
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 200 KB # of queries: 8884
2 Correct 144 ms 200 KB # of queries: 8522
3 Correct 184 ms 200 KB # of queries: 8998
4 Correct 134 ms 200 KB # of queries: 9859
5 Correct 173 ms 200 KB # of queries: 10046
6 Correct 156 ms 200 KB # of queries: 9415
7 Correct 128 ms 200 KB # of queries: 9868
8 Correct 197 ms 200 KB # of queries: 9922
9 Correct 187 ms 200 KB # of queries: 9823
10 Correct 73 ms 200 KB # of queries: 4097
11 Runtime error 1 ms 200 KB Execution killed with signal 13
12 Halted 0 ms 0 KB -