| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 65666 | imeimi2000 | 두 로봇 (KOI18_robot) | C++17 | 139 ms | 59008 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
struct _edge {
    int x, c;
    _edge(int x, int c) : x(x), c(c) {}
};
int n, s, e;
vector<_edge> edge[100001];
int mx[100001];
int dist[100001];
void dfs(int x, int p) {
    for (_edge i : edge[x]) {
        if (i.x == p) continue;
        mx[i.x] = max(mx[x], i.c);
        dist[i.x] = dist[x] + i.c;
        dfs(i.x, x);
    }
}
int main() {
    scanf("%d%d%d", &n, &s, &e);
    for (int i = 1; i < n; ++i) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        edge[a].emplace_back(b, c);
        edge[b].emplace_back(a, c);
    }
    dfs(s, 0);
    printf("%d\n", dist[e] - mx[e]);
	return 0;
}
Compilation message (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... | ||||
