Submission #249449

# Submission time Handle Problem Language Result Execution time Memory
249449 2020-07-15T04:46:12 Z shenxy Meetings (JOI19_meetings) C++14
0 / 100
2000 ms 9188 KB
#include "meetings.h"
#include <algorithm>
using namespace std;
void Solve(int N) {
	int lca[N][N];
	for (int i = 1; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) lca[i][j] = lca[j][i] = Query(0, i, j);
	}
	for (int i = 1; i < N; ++i) lca[0][i] = lca[i][0] = 0;
	int depth[N], parent[N];
	fill_n(depth, N, N + 1);
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			if (depth[j] == N + 1) {
				depth[j] = 0;
				parent[j] = -1;
				for (int k = 0; k < N; ++k) {
					if (k == j) continue;
					if (depth[lca[j][k]] + 1 > depth[j]) depth[j] = min(N, depth[lca[j][k]]) + 1, parent[j] = lca[j][k];
				}
			}
		}
	}
	for (int i = 0; i < N; ++i) {
		if (parent[i] != -1) Bridge(i, parent[i]);
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3066 ms 9188 KB Time limit exceeded
2 Halted 0 ms 0 KB -