답안 #1097487

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097487 2024-10-07T13:12:38 Z Alihan_8 도서관 (JOI18_library) C++17
19 / 100
231 ms 592 KB
#include "library.h"

#include <bits/stdc++.h>

using namespace std;

#define pb push_back

void Solve(int n){
	vector <int> ans, us(n);
	
	int lst = -1;
	
	for ( int x = 0; x < n; x++ ){
		vector <int> t, e;
		
		for ( int i = 0; i < n; i++ ){
			if ( !us[i] ) t.pb(i);
			else e.pb(i);
		}
		
		if ( x + 1 == n ){
			ans.pb(t[0] + 1);
			break;
		}
		
		vector <int> M(n);
		
		for ( auto &u: t ) M[u] = 1;
		
		for ( auto &j: t ){
			if ( j == lst ) continue;
			
			M[j] = 0;
			
			if ( Query(M) == 1 ){
				if ( lst == -1 ){
					lst = j;
				} else{
					ans.pb(j + 1);
					us[j] = 1;
				} 
			}
			
			M[j] = 1;
		}
	}
	
	Answer(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 151 ms 412 KB # of queries: 18337
2 Correct 185 ms 416 KB # of queries: 18146
3 Correct 180 ms 412 KB # of queries: 19901
4 Correct 188 ms 412 KB # of queries: 19901
5 Correct 178 ms 416 KB # of queries: 19901
6 Correct 181 ms 416 KB # of queries: 19901
7 Correct 231 ms 416 KB # of queries: 19901
8 Correct 175 ms 344 KB # of queries: 18529
9 Correct 181 ms 592 KB # of queries: 19702
10 Correct 67 ms 344 KB # of queries: 8257
11 Correct 0 ms 344 KB # of queries: 0
12 Correct 0 ms 344 KB # of queries: 2
13 Correct 0 ms 344 KB # of queries: 4
14 Correct 0 ms 344 KB # of queries: 7
15 Correct 1 ms 344 KB # of queries: 106
16 Correct 3 ms 344 KB # of queries: 352
# 결과 실행 시간 메모리 Grader output
1 Correct 151 ms 412 KB # of queries: 18337
2 Correct 185 ms 416 KB # of queries: 18146
3 Correct 180 ms 412 KB # of queries: 19901
4 Correct 188 ms 412 KB # of queries: 19901
5 Correct 178 ms 416 KB # of queries: 19901
6 Correct 181 ms 416 KB # of queries: 19901
7 Correct 231 ms 416 KB # of queries: 19901
8 Correct 175 ms 344 KB # of queries: 18529
9 Correct 181 ms 592 KB # of queries: 19702
10 Correct 67 ms 344 KB # of queries: 8257
11 Correct 0 ms 344 KB # of queries: 0
12 Correct 0 ms 344 KB # of queries: 2
13 Correct 0 ms 344 KB # of queries: 4
14 Correct 0 ms 344 KB # of queries: 7
15 Correct 1 ms 344 KB # of queries: 106
16 Correct 3 ms 344 KB # of queries: 352
17 Runtime error 216 ms 440 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -