Submission #1368177

#TimeUsernameProblemLanguageResultExecution timeMemory
1368177kaiboyMeetings (JOI19_meetings)C++20
0 / 100
2024 ms4544 KiB
#include "meetings.h"
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 2000;

void Solve(int n) {
	bool aa[N][N];
	int dd[N], kk[N];

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			aa[i][j] = false;
		dd[i] = 0;
	}
	aa[0][1] = aa[1][0] = true, dd[0]++, dd[1]++;
	for (int i_ = 2; i_ < n; i_++) {
		if (dd[i_])
			continue;
		for (int c = 0; c < n; c++)
			kk[c] = 0;
		for (int i = 0; i < n; i++)
			for (int j = i + 1; j < n; j++)
				if (aa[i][j])
					kk[Query(i, j, i_)]++;
		for (int c = 0; c < n; c++)
			if (kk[c] == dd[c]) {
				aa[i_][c] = aa[c][i_] = true, dd[i_]++, dd[c]++;
				break;
			}
	}
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (aa[i][j])
				Bridge(i, j);
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...