# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
28928 | h0ngjun7 | 경주 (Race) (IOI11_race) | C++14 | 3057 ms | 69976 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "race.h"
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
const int MAXN = 200005;
struct EDGE { int x, w; };
int N, K, ans = -1;
vector <EDGE> v[MAXN];
void f(int x, int par, unordered_map <int, int> &d) {
d[0] = 0;
for (auto &y : v[x]) {
if (y.x == par) continue;
unordered_map <int, int> d2, d3;
f(y.x, x, d2);
for (auto &t : d2) {
if (t.first + y.w > K) continue;
d3[t.first + y.w] = t.second + 1;
}
d2.clear();
if (d.size() < d3.size()) d.swap(d3);
for (auto &t : d3) {
if (d.count(K - t.first)) {
if (ans == -1 || ans > d[K - t.first] + t.second)
ans = d[K - t.first] + t.second;
}
}
for (auto &t : d3) {
# | 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... |