| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 904843 | 406 | Meetings (JOI19_meetings) | C++17 | 739 ms | 1064 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
void bridge(int u, int v) {
if (u > v) swap(u, v);
assert(u != v);
Bridge(u, v);
}
void solve(vector<int> &T) {
if (T.size() <= 1)
return;
if (T.size() == 2) {
bridge(T[0], T[1]);
return;
}
assert(T[0] != T[1]);
vector<int> path;
map<int, vector<int>> S;
for (int i = 2; i < T.size(); ++i) {
int q = Query(T[0], T[1], T[i]);
if (q != T[0] && q != T[1])
path.push_back(q);
S[q].push_back(T[i]);
}
sort(path.begin(), path.end());
path.resize(unique(path.begin(), path.end()) - path.begin());
sort(path.begin(), path.end(), [&](int u, int v) {return Query(T[0], u, v) == u;});
path.insert(path.begin(), T[0]);
path.push_back(T[1]);
for (int i = 1; i < path.size(); ++i)
bridge(path[i], path[i - 1]);
S[T[0]].push_back(T[0]);
S[T[1]].push_back(T[1]);
for (auto [u, T0]: S) solve(T0);
}
void Solve(int32_t n){
srand(time(NULL));
vector<int> nodes(n);
iota(nodes.begin(), nodes.end(), 0);
mt19937 rng((int64_t) new char);
shuffle(nodes.begin(), nodes.end(), rng);
solve(nodes);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
