Submission #996513

#TimeUsernameProblemLanguageResultExecution timeMemory
9965133lektraCrocodile's Underground City (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define vi vector<int> #define vc vector #define pi pair<int,int> using namespace std; vc<vc<pi>> edg; // Edges, aka the corridors coming out from each room vc<pi> dis; // The two minimum distances found between 2 nodes. The fastest route will just be used to calculate the second fastest, which is the oke that will be used to obtain the other distances int fpath = -1e9-7; // Fastest path int u, c; // Amazing the amount of situations when a node and a cost can be useful void dijkstra(vi p){ // First Node priority_queue<pi> tv; // To Visit, not TeleVision or To Vandalize for(int i : p){ tv.push({0,i}); dis[i].first = 0;} while(!tv.empty()){ u = tv.top().second; // The node being explored right now c = tv.top().first; // The cost to get to u tv.pop(); if(dis[u].second>c){continue;} // If this path is worse then why bother if(u == 0){ fpath = max(fpath, c); continue;} for(pi p : edg[u]){ // p.first = cost, p.second = node the path leads to if (p.first + c > dis[p.second].second){ // If this is path you've found is fastest than the second fastest one... if (p.first + c > dis[p.second].first){ // And than the fastest one... dis[p.second].second = dis[p.second].first; // Then the previously fastest one becomes the second fastest one... dis[p.second].first = p.first + c;} // This new path becomes the fastest! else{ // But if it's not fastest than the fastest one... dis[p.second].second = p.first + c;} tv.push({dis[p.second].second, p.second}); } } } } int travel_plan(int n, int m, vc<vi> r, vi l, int k, vi p){ edg = vc<vc<pi>>(n); for(int i = 0; i < m; i++){ edg[r[i][0]].push_back({-l[i],r[i][1]}); edg[r[i][1]].push_back({-l[i],r[i][0]});} dis = vc<pi>(n,{-1e9-7,-1e9-7}); dijkstra(p); //for(pi i : dis){cout << i.first << ' ' << i.second << " -- ";} //cout << -fpath; return -fpath;} int main(){ //cout << "Hi... this is a Jumpscare because you didn't expect to get this far >:)"; travel_plan(5,7, {{0,2},{0,3},{3,2},{2,1},{0,1},{0,4},{3,4}},{4,3,2,10,100,7,9},2,{1,3}); return 0;}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc8YsmUt.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cczoKPWt.o:crocodile.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc8YsmUt.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