Submission #1126048

#TimeUsernameProblemLanguageResultExecution timeMemory
1126048m_bezrutchkaDreaming (IOI13_dreaming)C++20
Compilation error
0 ms0 KiB
#include "dreaming.h" #include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int, int> pii; const int MAXN = 1e5 + 10; vector<pii> adj[MAXN]; int n, distante; int dist[MAXN]; vector<vector<pii>> chains; bool mrk_1[MAXN], mrk_2[MAXN]; void dfs(int v, int c, bool save) { mrk_1[v] = true; if (save) { mrk_2[v] = true; chains.back().push_back({v, c}); } if (dist[distante] < dist[v]) { distante = v; } for (auto [w, nc]: adj[v]) { if (mrk_1[w]) continue; dist[w] = dist[v] + nc; dfs(w, nc, save); } } void find_chain(int v) { for (int i = 0; i < n; i++) { mrk_1[i] = false; } distante = v; dist[v] = 0; dfs(v, 0, 0); for (int i = 0; i < n; i++) { mrk_1[i] = false; } chains.push_back({}); dist[distante] = 0; dfs(distante, 0, 1); } int32_t travelTime(int N, int M, int L, int A[], int B[], int T[]) { // subtask 1 n = N; for (int i = 0; i < M; i++) { adj[A[i]].push_back({B[i], T[i]}); adj[B[i]].push_back({A[i], T[i]}); } for (int i = 0; i < n; i++) { if (!mrk_2[i]) find_chain(i); } int resp = 0; for (auto &v: chains) { int tot = 0; for (pii &x: v) { tot += x.second; } int l = 0, r = tot; int best = tot; for (pii &x: v) { l += x.second; r -= x.second; best = min(best, max(l, r)); } resp += best; } return resp + L; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccO5dWFi.o: in function `main':
grader.c:(.text.startup+0xc4): undefined reference to `travelTime'
collect2: error: ld returned 1 exit status