Submission #314150

# Submission time Handle Problem Language Result Execution time Memory
314150 2020-10-18T18:14:54 Z a_player Library (JOI18_library) C++14
0 / 100
310 ms 512 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;

void Solve(int N)
{
	if(N==1)Answer({1}),exit(0);
	vector<vector<int> > a(N+1);
	vector<int> M(N);
	for(int i=1;i<=N;i++)
	for(int j=1;j<i;j++){
		M[i-1]=1;
		M[j-1]=1;
		int p=Query(M);
		if(p==1){
			a[i].push_back(j);
			a[j].push_back(i);
		}
		M[i-1]=0;
		M[j-1]=0;
	}
	int in=-1;
	for(int i=1;i<=N;i++)if(a[i].size()==1)in=i;
  vector<int> sol;
	sol.push_back(in);
	M[in-1]=1;
	in=a[in][0];
	while(a[in].size()!=1){
		sol.push_back(in);
		M[in-1]=1;
		if(M[a[in][0]-1])in=a[in][1];
		else in=a[in][0];
	}
	sol.push_back(in);
	Answer(sol);
}
# Verdict Execution time Memory Grader output
1 Correct 186 ms 376 KB # of queries: 18336
2 Correct 287 ms 376 KB # of queries: 18145
3 Correct 304 ms 376 KB # of queries: 19900
4 Correct 255 ms 376 KB # of queries: 19900
5 Correct 258 ms 372 KB # of queries: 19900
6 Correct 263 ms 384 KB # of queries: 19900
7 Correct 289 ms 512 KB # of queries: 19900
8 Correct 310 ms 376 KB # of queries: 18528
9 Correct 284 ms 376 KB # of queries: 19701
10 Correct 132 ms 256 KB # of queries: 8256
11 Incorrect 0 ms 256 KB Unexpected end of file - token expected
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 186 ms 376 KB # of queries: 18336
2 Correct 287 ms 376 KB # of queries: 18145
3 Correct 304 ms 376 KB # of queries: 19900
4 Correct 255 ms 376 KB # of queries: 19900
5 Correct 258 ms 372 KB # of queries: 19900
6 Correct 263 ms 384 KB # of queries: 19900
7 Correct 289 ms 512 KB # of queries: 19900
8 Correct 310 ms 376 KB # of queries: 18528
9 Correct 284 ms 376 KB # of queries: 19701
10 Correct 132 ms 256 KB # of queries: 8256
11 Incorrect 0 ms 256 KB Unexpected end of file - token expected
12 Halted 0 ms 0 KB -