Submission #125340

# Submission time Handle Problem Language Result Execution time Memory
125340 2019-07-05T06:09:46 Z 구재현(#3066) Park (JOI17_park) C++14
10 / 100
376 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){
	sort(v.begin(), v.end());
	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], v.back()};
	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);
		}
	}
	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 17 ms 376 KB Output is correct
4 Correct 17 ms 376 KB Output is correct
5 Correct 17 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 376 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 -