Submission #494316

# Submission time Handle Problem Language Result Execution time Memory
494316 2021-12-15T05:58:55 Z keertan Crocodile's Underground City (IOI11_crocodile) C++
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define int  int64_t
#define all(x) x.begin(),x.end()
#define all1(x) x.rbegin(),x.rend()
#define sz(x) (int)(x.size())
const int N=1e4+5,N1=1e18,mod=1e9+7;

void solve(){
  int n,m,k;
  cin>>n>>m>>k;
  n+=5;
  using gh=pair<int,int>;
  vector<pair<int,int>> adj[n];
  for (int i=1,u,v,w;i<=m;i++){
    cin>>u>>v>>w;
    adj[u].emplace_back(v,w);
    adj[v].emplace_back(u,w);
  }
  vector<gh> dis(n,{N1,N1});
  priority_queue<gh,vector<gh>,greater<gh>> q;
  vector<bool> vis(n);
  for (int i=0,x;i<k;i++){
    cin>>x;
    q.emplace(0,x);
    dis[x]={0,0};
  }
  while(!q.empty()){
    int u,dis1;
    tie(dis1,u)=q.top();
    q.pop();
    //cerr<<u<<" "<<dis1<<"\n";
    if (vis[u]){continue;}
    vis[u]=1;
    for (const gh &it:adj[u]){
      int cur=dis1+it.second;
      if (dis[it.first].first>=cur){
        dis[it.first].second=dis[it.first].first;
        dis[it.first].first=cur;
      }
      else if (cur<dis[it.first].second){
        dis[it.first].second=cur;
      }
      if (dis[it.first].first!=N1 && dis[it.first].second!=N1 && !vis[it.first]){
        q.emplace(dis[it.first].second,it.first);
      }
    }
  }
  cout<<dis[0].second;
}
int32_t main(){
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int tq=1;
    //cin>>tq;
    for (;tq;tq--){solve();}
} 

Compilation message

/usr/bin/ld: /tmp/ccE5bdk6.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWxqDo8.o:crocodile.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccE5bdk6.o: in function `main':
grader.cpp:(.text.startup+0x36): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status