Submission #1012429

#TimeUsernameProblemLanguageResultExecution timeMemory
1012429DorostWefDreaming (IOI13_dreaming)C++17
Compilation error
0 ms0 KiB
#pragma once #include <bits/stdc++.h> using namespace std; #define mk make_pair const int N = 100005; vector <pair <int, int>> g[N]; int dis[2][N]; vector <int> v; bool vis[N]; void dfs (int x, int in) { v.push_back(x); vis[x] = true; for (auto [y, w] : g[x]) { if (!vis[y]) { dis[in][y] = dis[in][x] + w; dfs (y, in); } } } int travelTime(int N, int M, int L, int A[], int B[], int T[]) { for (int i = 0; i < M; i++) { g[A[i]].push_back(mk(B[i], T[i])); g[B[i]].push_back(mk(A[i], T[i])); } vector <int> wef; int mx = 0; for (int i = 0; i < N; i++) { if (!vis[i]) { v.clear(); dis[0][i] = 0; dfs(i, 0); int x = i; for (int w : v) { if (dis[0][w] > dis[0][x]) x = w; vis[w] = false; } v.clear(); dis[0][x] = 0; dfs (x, 0); int y = x; for (int w : v) { if (dis[0][w] > dis[0][y]) y = w; vis[w] = false; } v.clear(); dis[1][y] = 0; dfs (y, 1); mx = max(mx, dis[1][x]); int mn = mx; for (int i : v) { mn = min(mn, max (dis[0][i], dis[1][i])); } wef.push_back(mn); } } sort (wef.begin(), wef.end()); reverse (wef.begin(), wef.end()); wef.push_back(0); wef.push_back(0); wef.push_back(0); mx = max(mx, wef[0] + wef[1] + L); mx = max(mx, wef[1] + wef[2] + L + L); return mx; }

Compilation message (stderr)

dreaming.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
/usr/bin/ld: /tmp/cczCMSa1.o: in function `main':
grader.c:(.text.startup+0xd1): undefined reference to `travelTime'
collect2: error: ld returned 1 exit status