| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 779907 | rxlfd314 | Meetings (JOI19_meetings) | C++17 | 25 ms | 568 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
void solve(vector<int> V) {
if (V.size() < 2) return;
int a = V[rand()%V.size()], b = V[rand()%V.size()];
while (b == a) {
b = V[rand()%V.size()];
}
map<int, vector<int>> subtrees;
vector<int> roots = {a};
map<int, bool> seen, pushed;
seen[a] = seen[b] = true;
for (int i : V) {
if (seen[i]) continue;
int c = Query(i, a, b);
if (c == i) {
roots.push_back(c);
pushed[c] = true;
}
seen[c] = true;
subtrees[c].push_back(i);
}
roots.push_back(b);
sort(roots.begin(), roots.end(), [&](const int &i, const int &j) {
return i == a || j == b ? true : i == b || j == a ? false : Query(a, i, j) == i;
});
for (int i = 0; i+1 < roots.size(); i++) {
Bridge(min(roots[i], roots[i+1]), max(roots[i], roots[i+1]));
}
//cerr << "Path: " << a << ", " << b << '\n';
for (int i : roots) {
if (!pushed[i]) {
subtrees[i].push_back(i);
}
//cerr << "Root: " << i << '\n';
solve(subtrees[i]);
}
}
void Solve(int N) {
srand(time(NULL));
vector<int> v(N);
iota(v.begin(), v.end(), 0);
solve(v);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
