# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9820 | Yoon | Your life (kriii2_Y) | C++98 | 92 ms | 8092 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;
int N,M;
vector< pair<int,int> > adj[100010];
vector<int> dijkstra(int src)
{
vector<int> dist(N+1,1234567890);
dist[src]=0;
priority_queue< pair<int,int> > pq;
pq.push(make_pair(0,src));
while(!pq.empty()){
int cost=-pq.top().first;
int here=pq.top().second;
pq.pop();
if(dist[here]<cost)continue;
for(int i=0;i<adj[here].size();++i){
int there=adj[here][i].first;
int nextDist=cost+adj[here][i].second;
if(dist[there]>nextDist){
dist[there]=nextDist;
pq.push(make_pair(-nextDist,there));
}
}
}
return dist;
}
int main()
{
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |