QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#611893#8022. WalkerLJY_ljyWA 1ms3872kbC++11969b2024-10-04 23:48:432024-10-04 23:48:43

Judging History

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

  • [2024-10-04 23:48:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3872kb
  • [2024-10-04 23:48:43]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const double eps = 1e-7;
const double INF = 1e10;
double n, p1, v1, p2, v2;

int main() {
	int t; scanf("%d", &t);
	for (int u = 1; u <= t; u++) {
		scanf("%lf %lf %lf %lf %lf", &n, &p1, &v1, &p2, &v2);
		if (p1 > p2) {
			swap(p1, p2);
			swap(v1, v2);
		}
		double l = 0, r = INF;
		while (r - l > eps) {
			double mid = (r + l) / 2;
			double S1 = mid * v1, S2 = mid * v2;
			bool flag = false;
			// LL
			if (S1 >= 2 * n + p1 - p2 || S2 >= 2 * n) flag = true;
			// RR
			if (S1 >= 2 * n || S2 >= 2 * n + p1 - p2) flag = true;
			// LR
			if (S1 + S2 >= 2 * n + p1 - p2) flag = true;
			// RL
			if (S1 >= n - p1 && S2 >= p2) flag = true;
			if (S1 < n - p1 && S1 + S2 >= 2 * n) flag = true;
			if (S2 < p2 && S1 + S2 >= 2 * n) flag = true;
			if (flag) r = mid;
			else l = mid;
		}
		printf("%.10lf\n", l);
	}
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3872kb

input:

2
10000.0 1.0 0.001 9999.0 0.001
4306.063 4079.874 0.607 1033.423 0.847

output:

5000999.9999999627
3827.8370013273

result:

ok 2 numbers

Test #2:

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

input:

1
10.0 1.0 10.0 9.0 0.1

output:

1.1881187700

result:

wrong answer 1st numbers differ - expected: '1.1000000', found: '1.1881188', error = '0.0801080'