QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#563956#9293. Fine Tripzjy0001WA 0ms35368kbC++14855b2024-09-14 17:59:062024-09-14 17:59:06

Judging History

你现在查看的是最新测评结果

  • [2024-09-14 17:59:06]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:35368kb
  • [2024-09-14 17:59:06]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define LLL __int128
#define uint unsigned
#define ldb long double
#define uLL unsigned long long
using namespace std;
const int N=2e3+5;
const LL INF=4e18;
int n,m;LL T,ans=INF,d[N][N];
vector<pair<int,LL>>G[N];
signed main(){
	cin.tie(0)->sync_with_stdio(0);
	cin>>n>>m>>T;
	if(n==1)return cout<<"0\n",0;
	for(int i=1;i<=m;++i){
		int u,v,l,c;cin>>u>>v>>l>>c;
		G[u].emplace_back(v,1ll*l*c);
		G[v].emplace_back(u,1ll*l*c);
	}
	memset(d,0x3f,sizeof(d));
	d[0][1]=0;
	for(int k=0;k<n;++k){
		for(int u=1;u<=n;++u)if(d[k][u]<INF)
			for(auto [v,w]:G[u])
				d[k+1][v]=min(d[k+1][v],d[k][u]+w);
	}
	for(int k=1;k<=n;++k)
		if(d[k][n]<=INF/k)ans=min(ans,d[k][n]*k);
	cout<<fixed<<setprecision(10)<<1.L*ans/T<<'\n';
	return 0;
}
/*
3 3 100
1 3 100 100
1 2 100 24
2 3 100 24
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 35332kb

input:

3 3 100
1 3 100 100
1 2 100 24
2 3 100 24

output:

96.0000000000

result:

ok found '96.0000000', expected '96.0000000', error '0.0000000'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 35368kb

input:

3 2 10
1 2 9 1
2 3 1 1000

output:

201.8000000000

result:

wrong answer 1st numbers differ - expected: '119.8736660', found: '201.8000000', error = '0.6834390'