Submission #1323793

#TimeUsernameProblemLanguageResultExecution timeMemory
1323793Trisanu_Das경주 (Race) (IOI11_race)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "race.h" using namespace std; #define ff first #define ss second int K, ans = INT_MAX; vector<pair<int, int>> adj[200005]; set<pair<int, int>> S[200005]; void dfs(int u, int par, int dist, int depth) { S[u].insert({dist, depth}); for(auto v : adj[u]){ if(v.ff != par){ dfs(v.ff, u, dist + v.ss, depth + 1); if(S[u].size() < S[v.ff].size()) swap(S[u], S[v.ff]); for(auto d : S[v.ff]){ int o = K + 2 * dist - d.f; auto x = S[u].lower_bound({o, -1}); if(x != S[u].end() && (*x).ff == other) ans = min(ans, d.ss + (*x).ss - 2 * depth); } for(auto d : S[v.ff]) S[u].insert(d); } } } int best_path(int n, int k, int h[][2], int l[]) { k = K; for (int i = 0; i < n - 1; i++){ adj[h[i][0]].push_back({h[i][1], l[i]}); adj[h[i][1]].push_back({h[i][0], l[i]}); }K = k; dfs(0, 0, 0, 0); return (ans == INT_MAX) ? -1 : ans; }

Compilation message (stderr)

race.cpp: In function 'void dfs(int, int, int, int)':
race.cpp:16:42: error: 'struct std::pair<int, int>' has no member named 'f'
   16 |                 int o = K + 2 * dist - d.f;
      |                                          ^
race.cpp:18:50: error: 'other' was not declared in this scope
   18 |                 if(x != S[u].end() && (*x).ff == other)
      |                                                  ^~~~~