Submission #3461

# Submission time Handle Problem Language Result Execution time Memory
3461 2013-08-31T05:56:57 Z pichulia Following Flow (kriii1_F) C++
0 / 1
0 ms 8192 KB
#include<stdio.h>

int n,m;
int a[35][35][3];
int an[35];

double d[35][500105];
double la;

int main(){
	int i,j,k,in1,in2,in3;
	scanf("%d %d",&n,&m);
	for(i=1;i<=m;i++){
		scanf("%d %d %d",&in1,&in2,&in3);
		a[in1][++an[in1]][0]=in2;
		a[in1][an[in1]][1]=in3;
	}
	d[0][0]=1;
	double op;
	for(i=0;i<=250000;++i){
		for(j=0;j<n;++j){
			if(an[j]!=0){
				op=d[j][i]/(double)an[j];
				for(k=an[j];k>=1;--k)
					d[a[j][k][0]][i+a[j][k][1]]+=op;
			}
		}
		la+=d[n][i]*i;
	}
	printf("%lf",la);
}
# Verdict Execution time Memory Grader output
1 Memory limit exceeded 0 ms 8192 KB Memory limit exceeded
2 Halted 0 ms 0 KB -