Submission #60404

# Submission time Handle Problem Language Result Execution time Memory
60404 2018-07-24T06:03:34 Z ainta(#1738) Park (JOI17_park) C++11
10 / 100
578 ms 9104 KB
#include "park.h"
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;


static int Place[1400];
int vis[1400][1400], ad[1400][1400], n;
int Ask2(int a, int b) {
	return Ask(min(a, b), max(a, b), Place);
}
void Go(vector<int>&R) {
	int sz = R.size();
	if (sz <= 1)return;
	int r = R[rand() % sz];
	for (int i = 0; i < n; i++)Place[i] = 0;
	Place[r] = 1;
	vector<int>adj;
	for (auto &x : R) {
		if (x == r)continue;
		Place[x] = 1;
		if (Ask2(r, x)) {
			Answer(min(r,x), max(r,x));
			ad[r][x] = 1;
			adj.push_back(x);
		}
		Place[x] = 0;
	}
	for (auto &x : adj) {
		for (auto &y : R)Place[y] = 1;
		Place[r] = 0;
		vector<int>TT;
		TT.push_back(x);
		for (auto &y : R) {
			if (r==y || vis[r][y] || ad[r][y])continue;
			if (Ask2(x, y)) {
				vis[r][y] = 1;
				TT.push_back(y);
			}
		}
		Go(TT);
	}
}
void Detect(int T, int N) {
	int i;
	srand(1879);
	n = N;
	vector<int>R;
	for (i = 0; i < N; i++)R.push_back(i);
	Go(R);
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Wrong Answer[6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 117 ms 8764 KB Output is correct
2 Correct 109 ms 8764 KB Output is correct
3 Correct 109 ms 8764 KB Output is correct
4 Correct 99 ms 9056 KB Output is correct
5 Correct 147 ms 9104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 297 ms 9104 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 226 ms 9104 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 578 ms 9104 KB Wrong Answer[5]
2 Halted 0 ms 0 KB -