Submission #1082066

#TimeUsernameProblemLanguageResultExecution timeMemory
1082066CELD_07Crocodile's Underground City (IOI11_crocodile)C++17
100 / 100
362 ms93356 KiB
#include "crocodile.h"
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#define ll long long
#define endl "\n"
#define inf 1e15
#define vll vector<ll>
#define sd second
#define ft first
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define pll pair<ll, ll>
#define mod 1000000007
#define _set tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
vector<vector<pair<ll, ll>>> adj;
vector<pair<ll, ll>> dist;
vector<bool> visited;
inline void dijkstra(int g[], int k){
priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;
for(int i=0; i<k; i++)pq.push({0, g[i]}), dist[g[i]]={0, 0};
while(!pq.empty()){
ll o, o1;
tie(o, o1)=pq.top();
pq.pop();
if(visited[o1])continue;
visited[o1]=1;
for(auto& [y, w]: adj[o1]){
if(o+w<dist[y].ft){
dist[y].sd=dist[y].ft;
dist[y].ft=o+w;
pq.push({dist[y].sd, y});
}else if(dist[y].sd>o+w){
dist[y].sd=o+w;
pq.push({dist[y].sd, y});
}
}
}
}
int travel_plan(int N, int M, int R[][2], int W[], int K, int E[]){
ll a, b, c, d, e;
adj.clear();
dist.clear();
visited.clear();
visited.assign(N+1, 0);
adj.resize(N+1);
dist.assign(N+1, {inf, inf});
for(int i=0; i<M; i++){
adj[R[i][0]].push_back({R[i][1], W[i]});
adj[R[i][1]].push_back({R[i][0], W[i]});
}
dijkstra(E, K);
return dist[0].sd;
}

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:42:4: warning: unused variable 'a' [-Wunused-variable]
   42 | ll a, b, c, d, e;
      |    ^
crocodile.cpp:42:7: warning: unused variable 'b' [-Wunused-variable]
   42 | ll a, b, c, d, e;
      |       ^
crocodile.cpp:42:10: warning: unused variable 'c' [-Wunused-variable]
   42 | ll a, b, c, d, e;
      |          ^
crocodile.cpp:42:13: warning: unused variable 'd' [-Wunused-variable]
   42 | ll a, b, c, d, e;
      |             ^
crocodile.cpp:42:16: warning: unused variable 'e' [-Wunused-variable]
   42 | ll a, b, c, d, e;
      |                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...