# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1090112 |
2024-09-17T18:01:14 Z |
LilPluton |
Race (IOI11_race) |
C++14 |
|
3000 ms |
8284 KB |
#include "race.h"
#include <bits/stdc++.h>
using namespace std;
const int sz = 2e5 + 5;
vector<vector<pair<int,int>>>adj(sz);
int n, res;
vector<long long> dist(sz), dep(sz, 0);
void dij(int s,int need){
dist.assign(sz, INT_MAX);
dep.assign(sz, INT_MAX);
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>q;
dep[s] = 0;
q.push({0, s});
while(!q.empty()){
int v = q.top().second;
int d_v = q.top().first;
if(d_v != dist[v]){
continue;
}
if(dist[v] == need){
res = min(1LL * res, dep[v]);
return;
}
for(auto i : adj[v]){
if(dist[i.first] > dist[v] + i.second){
dep[i.first] = dep[v] + 1;
dist[i.first] = dist[v] + i.second;
q.push({dist[i.first], i.first});
}
}
}
}
int best_path(int N, int K, int H[][2], int L[])
{
if(K == 1){
return 0;
}
n = N;
for(int i = 0; i < n; ++i){
adj[H[i][0]].push_back({H[i][1], L[i]});
adj[H[i][1]].push_back({H[i][0], L[i]});
}
res = INT_MAX;
for(int i = 0; i < n; ++i){
dij(i, K);
}
return (res == INT_MAX ? -1 : res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3059 ms |
8284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3059 ms |
8284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3059 ms |
8284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3059 ms |
8284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |