제출 #1027666

#제출 시각아이디문제언어결과실행 시간메모리
1027666vjudge1Meetings (JOI19_meetings)C++17
29 / 100
1588 ms640 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; int sz[500]; int o[500]; vector<int> chil[500]; void Solve(int N) { sz[0] = N; for (int i = 1; i < N; i++) { for (int j = 1; j < N; j++) { if (i == j) continue; if (Query(0, i, j) == i) { sz[i]++; chil[i].push_back(j); } } o[i] = i; } // for (int i = 1; i < N; i++) { // for (int c : chil[i]) cout << c << ' '; // cout << '\n'; // } sort(o, o + N, [&](int i, int j) { return sz[i] < sz[j]; }); bool us[N] = {}; for (int cur : o) { for (int v : chil[cur]) { if (us[v]) continue; us[v] = true; if (cur < v) Bridge(cur, v); else Bridge(v, cur); } } for (int i = 1; i < N; i++) if (!us[i]) Bridge(0, i); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...