/**
* بسم الله الرحمن الرحيم *
﴾ رَبِّ اشْرَحْ لِي صَدْرِي * وَيَسِّرْ لِي أَمْرِي * وَاحْلُلْ عُقْدَةً مِّن لِّسَانِي * يَفْقَهُوا قَوْلِي ﴿
*/
/// author : "ASGA_RedSea"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
double solve(int n,int m,int k,int H,vector <int> x,vector <int> y,vector <int> t,vector <int> aa);
vector <vector <pair <int,int>>> a;
vector <double> v;
vector <int> s;
int h;
double calc(int i,double time,int k,int last){
if(i == h)return time;
double ret = LLONG_MAX;
for(const auto& [j,t] : a[i]){
if(j == last)continue;
if(s[j] == 0){
if(v[j] - 0.000000000000 <= 1e-7)continue;
v[j] = 0.000000000000;
ret = min(ret,calc(j,0.000000000000,k,i));
}
else if(s[j] == 1){
if(v[j] - (time + t) <= 1e-7)continue;
v[j] = time + t;
ret = min(ret,calc(j,time + t,k,i));
}
else{
if(v[j] - (time + t) <= 1e-7)continue;
if(k > 0)ret = min(ret,calc(j,(time + t) / 2.0,k - 1,i));
ret = min(ret,calc(j,time,k,i));
}
}
return (ret == LLONG_MAX ? -1 : ret);
}
double solve(int n,int m,int k,int H,vector <int> x,vector <int> y,vector <int> t,vector <int> aa){
a.resize(n + 5);h = H;s = aa;
for(int i = 0;i < m;i++){
a[x[i]].push_back({y[i],t[i]});
a[y[i]].push_back({x[i],t[i]});
}
v = vector <double> (n + 5,LLONG_MAX);
double ans = calc(0,0.000000000000,k,-1);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3044 ms |
592 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
30 ms |
1084 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1116 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
8392 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
117 ms |
1088 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
1372 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1990 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2209 ms |
2097152 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |