Submission #260339

# Submission time Handle Problem Language Result Execution time Memory
260339 2020-08-10T06:03:01 Z 임성재(#5050) Library (JOI18_library) C++17
19 / 100
2000 ms 504 KB
#include "library.h"
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mp make_pair

static vector<int> g[222];
static bool chk[222];

void Solve(int N)
{
	vector<int> M(N, 0);

	for(int i=1; i<=N; i++) {
		for(int j=1; j<i; j++) {
			M[i-1] = M[j-1] = 1;

			if(Query(M) == 1) g[j].eb(i), g[i].eb(j);
			
			M[i-1] = M[j-1] = 0;
		}
	}

	int cur = 1;
	for(int i=1; i<=N; i++) {
		if(g[i].size() == 1) {
			cur = i;
			break;
		}
	}

	chk[cur] = true;
	vector<int> ans = {cur};

	for(int i=1; i<N; i++) {
		if(chk[g[cur][0]]) cur = g[cur][1];
		else cur = g[cur][0];

		chk[cur] = true;
		ans.eb(cur);
	}

	//for(auto i : ans) cout << i << " ";
	//cout << endl;

	Answer(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 310 ms 376 KB # of queries: 18336
2 Correct 291 ms 256 KB # of queries: 18145
3 Correct 366 ms 376 KB # of queries: 19900
4 Correct 251 ms 504 KB # of queries: 19900
5 Correct 351 ms 376 KB # of queries: 19900
6 Correct 285 ms 256 KB # of queries: 19900
7 Correct 345 ms 376 KB # of queries: 19900
8 Correct 241 ms 504 KB # of queries: 18528
9 Correct 349 ms 376 KB # of queries: 19701
10 Correct 168 ms 376 KB # of queries: 8256
11 Correct 0 ms 256 KB # of queries: 0
12 Correct 0 ms 256 KB # of queries: 1
13 Correct 0 ms 256 KB # of queries: 3
14 Correct 1 ms 256 KB # of queries: 6
15 Correct 1 ms 384 KB # of queries: 105
16 Correct 4 ms 256 KB # of queries: 351
# Verdict Execution time Memory Grader output
1 Correct 310 ms 376 KB # of queries: 18336
2 Correct 291 ms 256 KB # of queries: 18145
3 Correct 366 ms 376 KB # of queries: 19900
4 Correct 251 ms 504 KB # of queries: 19900
5 Correct 351 ms 376 KB # of queries: 19900
6 Correct 285 ms 256 KB # of queries: 19900
7 Correct 345 ms 376 KB # of queries: 19900
8 Correct 241 ms 504 KB # of queries: 18528
9 Correct 349 ms 376 KB # of queries: 19701
10 Correct 168 ms 376 KB # of queries: 8256
11 Correct 0 ms 256 KB # of queries: 0
12 Correct 0 ms 256 KB # of queries: 1
13 Correct 0 ms 256 KB # of queries: 3
14 Correct 1 ms 256 KB # of queries: 6
15 Correct 1 ms 384 KB # of queries: 105
16 Correct 4 ms 256 KB # of queries: 351
17 Execution timed out 3085 ms 504 KB Time limit exceeded
18 Halted 0 ms 0 KB -