Submission #125369

# Submission time Handle Problem Language Result Execution time Memory
125369 2019-07-05T07:06:28 Z 구재현(#3066) Park (JOI17_park) C++14
10 / 100
814 ms 1000 KB
#include "park.h"
#include <bits/stdc++.h>
using namespace std;

bool ask(int s, int e, vector<int> v){
	if(s > e) swap(s, e);
	int Place[1400] = {};
	v.push_back(s); v.push_back(e);
	for(auto &i : v) Place[i] = 1;
	return Ask(s, e, Place);
}

void dfs(vector<int> v){
	if(v.size() == 1) return;
	random_shuffle(v.begin(), v.end());
	int r = v[0];
	vector<int> adj;
	int j = -1;
	for(auto &i : v){
		if(i == r) continue;
		if(ask(i, r, {})){		
			j = i;
			break;
		}
	}
	vector<int> noj = v;
	noj.erase(find(noj.begin(), noj.end(), j));
	vector<int> ls, rs;
	for(auto &i : v){
		if(i == r || i == j) continue;
		if(ask(r, i, noj) == 1) ls.push_back(i);
		else rs.push_back(i);
	}
	Answer(min(r, j), max(r, j));
	ls.push_back(r);
	rs.push_back(j);
	dfs(ls);
	dfs(rs);
}

void Detect(int T, int N) {
	srand(69696969);
	vector<int> v(N);
	iota(v.begin(), v.end(), 0);
	dfs(v);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Wrong Answer[6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 84 ms 764 KB Output is correct
2 Correct 82 ms 504 KB Output is correct
3 Correct 66 ms 504 KB Output is correct
4 Correct 74 ms 504 KB Output is correct
5 Correct 105 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 418 ms 976 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 286 ms 888 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 814 ms 1000 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -