| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 131126 | IOrtroiii | Meetings (JOI19_meetings) | C++14 | 1595 ms | 1068 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;
mt19937 rng(10072002);
void addEdge(int u, int v) {
if (u > v) swap(u, v);
Bridge(u, v);
}
void go(int from, vector<int> comp) {
int id = rng() % (comp.size());
int to = comp[id];
swap(comp[id], comp.back());
comp.pop_back();
vector<int> path;
vector<pair<int, int>> vals;
for (int v : comp) {
int u = Query(from, to, v);
if (u == v) {
path.push_back(v);
} else {
vals.emplace_back(u, v);
}
}
if (path.empty()) {
addEdge(from, to);
} else {
sort(path.begin(), path.end(), [&](int x, int y) {
return Query(from, x, y) == x;
});
addEdge(from, path[0]);
for (int i = 0; i + 1 < path.size(); ++i) {
addEdge(path[i], path[i + 1]);
}
addEdge(path.back(), to);
}
sort(vals.begin(), vals.end());
int l = 0;
while (l < vals.size()) {
vector<int> ncomp;
int r = l;
while (r < vals.size() && vals[l].first == vals[r].first) {
ncomp.push_back(vals[r++].second);
}
go(vals[l].first, ncomp);
l = r;
}
}
void Solve(int n) {
vector<int> comp(n - 1);
iota(comp.begin(), comp.end(), 1);
go(0, comp);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
