Submission #3646

#TimeUsernameProblemLanguageResultExecution timeMemory
3646cki86201Following Flow (kriii1_F)C++98
Compilation error
0 ms0 KiB
#include<stdio.h> #include<vector> #include<time.h> struct edge{ int st,en,len; }; edge data[1005]; double t[2][35],p[2][35]; double cnt[35]; int n,m; int main() { freopen("input.txt","r",stdin); double ans=0; int s=0, e=1, cnt=0; scanf("%d%d",&n,&m); for(int i=0;i<m;i++){ scanf("%d%d%d",&data[i].st,&data[i].en,&data[i].len); cnt[data[i].st]++; } p[s][0]=1; while(++cnt<10000){ for(int i=0;i<=n;i++)p[e][i]=t[e][i]=0; for(int i=0;i<m;i++){ p[e][data[i].en]+=p[s][data[i].st]/cnt[data[i].st]; t[e][data[i].en]+=(t[s][data[i].st]+data[i].len*p[s][data[i].st])/cnt[data[i].st]; } ans+=t[e][n]; s=!s; e=!e; } printf("%.9lf",ans); }

Compilation message (stderr)

F.cpp: In function 'int main()':
F.cpp:20:17: error: invalid types 'int[int]' for array subscript
F.cpp:26:53: error: invalid types 'int[int]' for array subscript
F.cpp:27:84: error: invalid types 'int[int]' for array subscript
F.cpp:14:32: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
F.cpp:17:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
F.cpp:19:55: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]