Submission #125342

# Submission time Handle Problem Language Result Execution time Memory
125342 2019-07-05T06:11:25 Z 구재현(#3066) Park (JOI17_park) C++14
10 / 100
386 ms 262148 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() == 2){
		Answer(v[0], v[1]);
		return;
	}
	random_shuffle(v.begin() + 1, v.end() - 1);
	int m = v.size() / 2;
	vector<int> nxt = v;
	vector<int> ingyeo = {v[m]};
	for(auto &i : v){
		if(i == v[0] || i == v.back() || i == v[m]) continue;
		nxt.erase(find(nxt.begin(), nxt.end(), i));
		if(ask(v[0], v[m], nxt) == 0){
			nxt.push_back(i);
		}
		else{
			ingyeo.push_back(i);
		}
	}
	swap(nxt[0], *find(nxt.begin(), nxt.end(), v[0]));
	swap(nxt.back(), *find(nxt.begin(), nxt.end(), v[m]));
	ingyeo.push_back(v.back());
	dfs(nxt);
	dfs(ingyeo);
}

void Detect(int T, int N) {
	srand(69696969);
	if(T == 1){
		for(int i=0; i<N; i++){
			for(int j=0; j<i; j++){
				if(ask(i, j, {})) Answer(j, i);
			}
		}
		return;
	}
	if(T == 2){
		vector<int> v(N);
		iota(v.begin(), v.end(), 0);
		dfs(v);
		return;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 14 ms 376 KB Output is correct
3 Correct 16 ms 376 KB Output is correct
4 Correct 14 ms 376 KB Output is correct
5 Correct 14 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 386 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 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 Incorrect 2 ms 376 KB Wrong Answer[6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Wrong Answer[6]
2 Halted 0 ms 0 KB -