# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9645 | ksmail12 | Your life (kriii2_Y) | C++98 | 120 ms | 8040 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 <iostream>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
vector<vector<int> > g;
int find(int n){
vector<int> dist(n+1, 0x7fffffff);
dist[1] = 0;
priority_queue<pair<int,int> >pq;
pq.push(make_pair(0, 1));
while(!pq.empty() ) {
int cost = -pq.top().first;
int here = pq.top().second;
pq.pop();
if(cost > dist[here]) {
continue;
}
for(int i=0;i<g[here].size();i++) {
int there = g[here][i];
int ndist = cost+1;
if(dist[there] > ndist) {
dist[there] = ndist;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |