| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1029332 | Blagoj | Meetings (JOI19_meetings) | C++17 | 683 ms | 16004 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;
#define endl '\n'
#define ll long long
#define all(x) (x).begin(), (x).end()
const int mxn = 2e4 + 100;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> C[mxn];
void merge(int a, int b) {
Bridge(min(a, b), max(a, b));
}
void solve(vector<int> v) {
int n = v.size();
if (n < 2) return;
shuffle(all(v), rng);
int x = v[0], y = v[1];
vector<int> between;
C[x].push_back(x);
C[y].push_back(y);
for (int i = 2; i < n; i++) {
int val = Query(x, y, v[i]);
if (val == v[i]) between.push_back(v[i]);
C[val].push_back(v[i]);
}
sort(all(between), [&] (int a, int b) {
return Query(x, a, b) == a;
});
between.insert(between.begin(), x);
between.push_back(y);
for (int i = 1; i < between.size(); i++) merge(between[i - 1], between[i]);
vector<vector<int>> toDo;
for (auto el : C) toDo.push_back(el);
for (auto el : between) C[el].clear();
for (auto el : toDo) solve(el);
}
void Solve(int N) {
vector<int> v;
for (int i = 0; i < N; i++) v.push_back(i);
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... | ||||
