Submission #125397

# Submission time Handle Problem Language Result Execution time Memory
125397 2019-07-05T07:59:11 Z 이온조(#3059) Park (JOI17_park) C++14
0 / 100
712 ms 888 KB
#include "park.h"
#include <bits/stdc++.h>
using namespace std;

static int N, P[1444], O[1444];

void answer(int u, int v) {
	if(u > v) swap(u, v);
	// printf("answer: %d %d\n", u, v);
	Answer(u, v);
}

int ask(int A, int B, int p[]) {
	if(A > B) swap(A, B);
	// printf("A: %d, B: %d\n", A, B);
	// printf("PLACE: ");
	// for(int i=0; i<N; i++) printf("%d", p[i]);
	// printf("\n result: ");
	int tmp = Ask(A, B, p);
	// printf("%d\n", tmp);
	return tmp;
}

void go(vector<int> &S, int id) {
	int K = S.size();
	if(K == 0) return;
	int x = S[rand() % K];

	if(K == 1) {
		O[S[0]] = id;
		return;
	}

	P[x] = 0;
	vector<int> L, R;
	for(auto& it: S) {
		if(it == x) continue;
		if(ask(0, it, P)) L.push_back(it);
		else R.push_back(it);
	}
	O[x] = id + L.size();
	P[x] = 1;

	go(L, id);
	go(R, id + L.size() + 1);
}

void Detect(int T, int N) {
	srand(190705);
	::N = N;
	vector<int> S;
	for(int i=1; i<N-1; i++) S.push_back(i);
	for(int i=0; i<N; i++) P[i] = 1;
	go(S, 1); O[0] = 0; O[N-1] = N-1;
	for(int i=1; i<N; i++) answer(O[i-1], O[i]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 158 ms 504 KB Wrong Answer[2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 494 ms 888 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 348 ms 656 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 712 ms 772 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -