Submission #543205

#TimeUsernameProblemLanguageResultExecution timeMemory
543205__VariattoCrocodile's Underground City (IOI11_crocodile)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define ll long long const ll MAX=1e5+10, MAXV=1e18; int n, m, k, ileSpe[MAX], odw[MAX]; ll odl[MAX]; bool spe[MAX]; vector<pair<int,int>>g[MAX]; priority_queue<pair<ll,int>>kol; ll obl(int x){ set<ll>se; for(auto s: g[x]) if(spe[s.fi]) se.insert(odl[s.fi]+s.se); se.erase(se.begin()); return(*se.begin()); } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ n=N, k=K, m=M; for(int i=1; i<=m; i++) g[R[i-1][0]+1].pb({R[i-1][1]+1, L[i-1]}), g[R[i-1][1]+1].pb({R[i-1][0]+1, L[i-1]}); for(int i=1; i<=k; i++){ int v=P[i-1]+1; spe[v]=true; } for(int i=1; i<=n; i++){ odl[i]=MAXV; if(spe[i]) kol.push({0, i}), odl[i]=0; } while(kol.size()){ auto v=kol.top().se; kol.pop(); if(odw[v]) continue; odw[v]=spe[v]=true; for(auto s: g[v]){ ileSpe[s.fi]++; if(ileSpe[s.fi]>=2){ int nowy=obl(s.fi); if(odl[s.fi]>nowy) odl[s.fi]=nowy, kol.push({-nowy, s.fi}); } } } return odl[1]; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); int N, M, K; cin>>N>>M; cin>>K; int R[M+3][2], L[M+3]; for(int i=0; i<M; i++) cin>>R[i][0]>>R[i][1]>>L[i]; int P[K+3]; for(int i=1; i<=K; i++) cin>>P[i-1]; cout<<travel_plan(N, M, R, L, K, P)<<"\n";; }

Compilation message (stderr)

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