| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1359306 | jump | Sightseeing (NOI14_sightseeing) | C++20 | 1302 ms | 164264 KiB |
#include <bits/stdc++.h>
int v,e,q;
int dist[500010];
std::vector<std::pair<int,int>> adj[500010];
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cin >> v >> e >> q;
for(int i=1;i<=e;i++){
int a,b,w;
std::cin >> a >> b >> w;
adj[a].push_back({b,w});
adj[b].push_back({a,w});
}
std::priority_queue<std::pair<int,int>> pq;
pq.push({1e18,1});
dist[1]=1e18;
while(!pq.empty()){
int qual = pq.top().first;
int node = pq.top().second;
pq.pop();
for(auto [to,parq]:adj[node]){
if(dist[to]<std::min(parq,qual)){
dist[to]=std::min(parq,qual);
pq.push({dist[to],to});
}
}
}
while(q--){
int ask;
std::cin >> ask;
std::cout << dist[ask] << '\n';
}
}Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
