Submission #1034624

#TimeUsernameProblemLanguageResultExecution timeMemory
1034624XXBabaProBerkayCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second using ll = long long; const double INF = 1e16 + 7; vector<vector<pair<int, double>>> adj; vector<bool> vis; void dfs(int k, int& H) { if (k == H || vis[k]) return; vis[k] = 1; for (auto i : adj[k]) dfs(i.F, H); } double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { adj.resize(N); vis.resize(N); for (int i = 0; i < M; i++) { adj[x[i]].emplace_back(y[i], c[i]); adj[y[i]].emplace_back(x[i], c[i]); } dfs(0, H); vector<vector<double>> dist(K + 1, vector<double>(N, INF)); for (int i = 0; i < N; i++) if (arr[i] == 0 && vis[i]) for (int j = 0; j <= K; j++) dist[j][i] = 0; for (int i = 0; i <= K; i++) { priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> PQ; dist[i][0] = 0; for (int j = 0; j < N; j++) if (dist[i][j] == 0) PQ.emplace(0, j); while (!PQ.empty()) { int u; double d; tie(d, u) = PQ.top(); PQ.pop(); if (d != dist[i][u] || u == H) continue; for (auto k : adj[u]) { int v; double w; tie(v, w) = k; bool flag = false; if (dist[i][v] > dist[i][u] + w) { dist[i][v] = dist[i][u] + w; flag = 1; } if (i > 0 && arr[v] == 2 && dist[i][v] > (dist[i - 1][u] + w) / 2.0) { dist[i][v] = min(dist[i][u] + w, (dist[i - 1][u] + w) / 2.0); flag = 1; } if (flag) PQ.emplace(dist[i][v], v); } } } return (dist[K][H] == INF ? -1 : dist[K][H]); } int main() { cout << solve(4, 4, 30, 3, {0, 0, 1, 2}, {1, 2, 3, 3}, {5, 4, 2, 4}, {1, 0, 2, 1}) << '\n'; cout << solve(3, 2, 30, 2, {1, 2}, {2, 0}, {12, 4}, {1, 2, 1}) << '\n'; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccbajcHL.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccdz1TBM.o:cyberland.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status