Submission #21909

#TimeUsernameProblemLanguageResultExecution timeMemory
21909iletavcioskiCrocodile's Underground City (IOI11_crocodile)C++98
Compilation error
0 ms0 KiB
#include<iostream> #include<vector> #include<queue> #include<cstdio> using namespace std; typedef long long ll; bool oznaceni[100001]; struct node { int a; ll val; }; const bool operator <(const node &x,const node&y) { return x.val>y.val; } vector<vector<pair<int,ll> > > v; using namespace std; int main() { int n,m,k; cin>>n>>m>>k; vector<pair<int,ll> > vec; v.insert(v.begin(),n+1,vec); vector<ll> dist1(n+1,1e9+1); vector<ll> dist2(n+1,1e9+1); for(int i=0;i<m;i++) { int a,b; ll c; cin>>a>>b>>c; v[a].push_back(make_pair(b,c)); v[b].push_back(make_pair(a,c)); } priority_queue<node> pq; for(int i=0;i<k;i++) { int a; cin>>a; node g; g.a=a; g.val=0; pq.push(g); dist1[a]=dist2[a]=0; } while(!pq.empty()) { node g=pq.top(); pq.pop(); int topi=g.a; ll tops=g.val; for(int i=0;i<v[topi].size();i++) { if(tops+v[topi][i].second<dist1[v[topi][i].first]) { int go=v[topi][i].first; dist2[go]=dist1[go]; dist1[go]=tops+v[topi][i].second; node gg; gg.a=go; gg.val=dist2[go]; pq.push(gg); } else if(tops+v[topi][i].second<dist2[v[topi][i].first]) { int go=v[topi][i].first; dist2[go]=tops+v[topi][i].second; node gg; gg.a=go; gg.val=v[topi][i].second+tops; pq.push(gg); } } } cout<<dist2[0]<<endl; return 0; } /* 5 7 2 0 2 4 0 3 3 3 2 2 2 1 10 0 1 100 0 4 7 3 4 9 1 3 */

Compilation message (stderr)

crocodile.cpp: In function 'int main()':
crocodile.cpp:52:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<v[topi].size();i++)
                      ^
/tmp/cckiSjzr.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cca8eITn.o:crocodile.cpp:(.text.startup+0x0): first defined here
/tmp/cckiSjzr.o: In function `main':
grader.cpp:(.text.startup+0x2d): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status