Submission #249448

# Submission time Handle Problem Language Result Execution time Memory
249448 2020-07-15T04:45:18 Z shenxy Meetings (JOI19_meetings) C++14
0 / 100
2 ms 512 KB
#include "meetings.h"
#include <algorithm>
using namespace std;
void Solve(int N) {
	int lca[N][N];
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) lca[i][j] = lca[j][i] = Query(0, i, j);
	}
	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 [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Wrong Answer [1]
2 Halted 0 ms 0 KB -