제출 #1187731

#제출 시각아이디문제언어결과실행 시간메모리
1187731oviyan_gandhiMeetings (JOI19_meetings)C++17
29 / 100
1284 ms2576 KiB
#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;

#define N 2001
set<int> path[N];

void Solve(int n) {
    for (int i = 1; i < n; i++)
        for (int j = 1; j < n; j++)
            if (i != j && Query(0, i, j) == j)
                path[i].insert(j);
    queue<int> q;
    for (int i = 1; i < n; i++) {
        if (path[i].empty()) {
            Bridge(0, i);
            q.push(i);
        }
    }
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v = 1; v < n; v++) {
            if (path[v].empty())
                continue;
            path[v].erase(u);
            if (path[v].empty()) {
                Bridge(min(u, v), max(u, v));
                q.push(v);
            }
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...