QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#606044#9293. Fine Triplym#WA 0ms3876kbC++201.1kb2024-10-02 21:48:432024-10-02 21:48:43

Judging History

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

  • [2024-10-02 21:48:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3876kb
  • [2024-10-02 21:48:43]
  • 提交

answer

#include<bits/stdc++.h>
using i64 = long long;
#define int i64
#define double long double
const double inf = 1e18;
using pii = std::pair<int, double>;
using ipp = std::pair<double, int>;
void solve() {
	int n, m, t;
	std::cin >> n >> m >> t;
	std::vector<std::vector<std::pair<int, double> > > e(n + 1);
	for (int i = 1; i <= m; i ++) {
		int u, v, a, b;
		std::cin >> u >> v >> a >> b;
		e[u].push_back({v, (double)std::sqrt((double)a * b)});
	}
	std::vector<double> d(n + 1, inf);
	std::vector<bool> vis(n + 1);
	d[1] = 0;
	std::priority_queue<ipp, std::vector<ipp>, std::greater<ipp> > q;
	q.push({0.0, 1});
	while (! q.empty()) {
		auto it = q.top();
		q.pop();
		int u = it.second;
		if (vis[u]) continue;
		vis[u] = 1;
		for (auto it : e[u]) {
			int v = it.first;
			double w = it.second;
			if (d[v] > d[u] + w) {
				d[v] = d[u] + w;
				q.push({d[v], v});
			}
		}
	}
	double ans = d[n] * d[n];
	printf("%.10lf\n", ans / t);
}
signed main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int t = 1;
	//std::cin >> t;
	while (t --) {
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3876kb

input:

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

output:

0.0000000000

result:

wrong answer 1st numbers differ - expected: '96.0000000', found: '0.0000000', error = '1.0000000'