fork download
  1. #include <bits/stdc++.h>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6. typedef map <int, int> mii;
  7. typedef pair <int, int> pii;
  8. typedef pair <ll, ll> pll;
  9. const int inf=1e9;
  10.  
  11. #define maxn 1000001
  12. #define mp make_pair
  13. #define pb push_back
  14. #define ff first
  15. #define ss second
  16. #define all(x) x.begin(), x.end()
  17. #include <conio.h>
  18. int n,m,x,y;
  19. int main(){
  20. scanf("%d %d",&n,&m);
  21. scanf("%d %d",&x,&y);
  22. vector < vector <double> >a(n+1, vector <double>(n+1,100));
  23. vector < vector <double> >b(n+1, vector <double>(n+1,inf));
  24.  
  25. for(int i=1;i<=n;i++) a[i][i]=0;
  26.  
  27. while(m--){
  28. int u,v,p;
  29. scanf("%d %d %d",&u,&v,&p);
  30.  
  31. a[u][v]-=p;
  32. a[v][u]-=p;
  33. b[u][v]=b[v][u]=p;
  34. }
  35.  
  36.  
  37. for(int k=1;k<=n;k++){
  38. for(int i=1;i<=n;i++){
  39. for(int j=1;j<=n;j++){
  40.  
  41. if( b[i][k]==inf || b[k][j]==inf || a[i][k]==100 || a[k][j]==100) continue;
  42.  
  43. if( a[i][j]==100){
  44. a[j][i]=a[i][j] = a[i][k]-( (double)(b[j][k]*a[i][k])/(double)100 );
  45. }
  46. else{
  47. double x1 = a[i][k]-( (double)(b[j][k]*a[i][k])/(double)100);
  48. if((double)(100-a[i][j])/(double)100> (double)(100-x1)/(double)100 && x1>=0 && x1<=100){
  49. a[j][i]=a[i][j]=x1;
  50. }
  51. }
  52. }
  53. }
  54. }
  55.  
  56.  
  57.  
  58. printf("%.6lf", (100-a[x][y])/100);
  59.  
  60. return 0;
  61. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:17:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
stdout
Standard output is empty