Submission #973548

#TimeUsernameProblemLanguageResultExecution timeMemory
973548SuPythonyCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
//#include "cyberland.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<vector<pair<int,int>>> al; vector<int> nodes; void dfs(int u, int p, int H, vector<int> &a) { if (u==H) return; if (a[u]==0) nodes.push_back(u); for (auto v: al[u]) { if (v.first==p) continue; dfs(v.first,u,H,a); } } double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> a) { al.assign(N+1,vector<pair<int,int>>()); nodes.clear(); for (int i=0; i<M; i++) { al[x[i]].push_back({y[i],c[i]}); al[y[i]].push_back({x[i],c[i]}); } dfs(0,-1,H,a); priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> q; vector<int> dist(N+1,1e9); dist[N]=0; q.push({0,N}); al[N].push_back({0,0}); for (int i: nodes) { al[N].push_back({i,0}); } vector<int> done(N+1,0); while (!q.empty()) { int u=q.top().second; q.pop(); for (auto v: al[u]) { if (done[v.first]) continue; if (dist[u]+v.second<dist[v.first]) { dist[v.first]=dist[u]+v.second; q.push({dist[v.first],v.first}); } } done[u]=true; } return (double)dist[H]; } int main() { vector<int> x={0,1,2}, y={1,2,3}, c={5,7,8}, a={1,1,0,1}; cout<<solve(4,3,30,3,x,y,c,a); }

Compilation message (stderr)

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