답안 #963432

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
963432 2024-04-15T02:11:10 Z 12345678 도서관 (JOI18_library) C++17
19 / 100
204 ms 596 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;

const int nx=1005;
int s;
vector<int> v[nx], res;

void dfs(int u, int p)
{
	res.push_back(u);
	for (auto x:v[u]) if (x!=p) dfs(x, u);
}

void Solve(int N)
{
	vector<int> M(N);
	for (int i=0; i<N; i++)
	{
		for (int j=i+1; j<N; j++)
		{
			M[i]=M[j]=1;
			if (Query(M)==1) v[i+1].push_back(j+1), v[j+1].push_back(i+1);
			M[i]=M[j]=0;
		}
	}
	s=1;
	for (int i=1; i<=N; i++) if (v[i].size()==1) s=i;
	res.clear();
	dfs(s, s);
	Answer(res);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 157 ms 444 KB # of queries: 18336
2 Correct 155 ms 456 KB # of queries: 18145
3 Correct 151 ms 440 KB # of queries: 19900
4 Correct 148 ms 452 KB # of queries: 19900
5 Correct 171 ms 448 KB # of queries: 19900
6 Correct 158 ms 444 KB # of queries: 19900
7 Correct 159 ms 460 KB # of queries: 19900
8 Correct 133 ms 452 KB # of queries: 18528
9 Correct 159 ms 440 KB # of queries: 19701
10 Correct 61 ms 456 KB # of queries: 8256
11 Correct 1 ms 344 KB # of queries: 0
12 Correct 0 ms 344 KB # of queries: 1
13 Correct 0 ms 596 KB # of queries: 3
14 Correct 0 ms 344 KB # of queries: 6
15 Correct 1 ms 344 KB # of queries: 105
16 Correct 2 ms 344 KB # of queries: 351
# 결과 실행 시간 메모리 Grader output
1 Correct 157 ms 444 KB # of queries: 18336
2 Correct 155 ms 456 KB # of queries: 18145
3 Correct 151 ms 440 KB # of queries: 19900
4 Correct 148 ms 452 KB # of queries: 19900
5 Correct 171 ms 448 KB # of queries: 19900
6 Correct 158 ms 444 KB # of queries: 19900
7 Correct 159 ms 460 KB # of queries: 19900
8 Correct 133 ms 452 KB # of queries: 18528
9 Correct 159 ms 440 KB # of queries: 19701
10 Correct 61 ms 456 KB # of queries: 8256
11 Correct 1 ms 344 KB # of queries: 0
12 Correct 0 ms 344 KB # of queries: 1
13 Correct 0 ms 596 KB # of queries: 3
14 Correct 0 ms 344 KB # of queries: 6
15 Correct 1 ms 344 KB # of queries: 105
16 Correct 2 ms 344 KB # of queries: 351
17 Runtime error 204 ms 436 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -