Submission #871949

# Submission time Handle Problem Language Result Execution time Memory
871949 2023-11-12T03:43:24 Z 12345678 Library (JOI18_library) C++17
0 / 100
167 ms 972 KB
#include <cstdio>
#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;
		}
	}
	for (int i=1; i<=N; i++) if ((int)v[i].size()==1) s=i;
	dfs(s, s);
	Answer(res);
}
# Verdict Execution time Memory Grader output
1 Correct 141 ms 696 KB # of queries: 18336
2 Correct 141 ms 460 KB # of queries: 18145
3 Correct 167 ms 708 KB # of queries: 19900
4 Correct 156 ms 444 KB # of queries: 19900
5 Correct 166 ms 448 KB # of queries: 19900
6 Correct 154 ms 456 KB # of queries: 19900
7 Correct 164 ms 692 KB # of queries: 19900
8 Correct 159 ms 972 KB # of queries: 18528
9 Correct 149 ms 696 KB # of queries: 19701
10 Correct 78 ms 688 KB # of queries: 8256
11 Incorrect 0 ms 344 KB Wrong Answer [5]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 141 ms 696 KB # of queries: 18336
2 Correct 141 ms 460 KB # of queries: 18145
3 Correct 167 ms 708 KB # of queries: 19900
4 Correct 156 ms 444 KB # of queries: 19900
5 Correct 166 ms 448 KB # of queries: 19900
6 Correct 154 ms 456 KB # of queries: 19900
7 Correct 164 ms 692 KB # of queries: 19900
8 Correct 159 ms 972 KB # of queries: 18528
9 Correct 149 ms 696 KB # of queries: 19701
10 Correct 78 ms 688 KB # of queries: 8256
11 Incorrect 0 ms 344 KB Wrong Answer [5]
12 Halted 0 ms 0 KB -