QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#209913#7110. Kuririn MIRACLEPetroTarnavskyi#WA 275ms3812kbC++171.4kb2023-10-10 19:26:492023-10-10 19:26:50

Judging History

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

  • [2023-10-10 19:26:50]
  • 评测
  • 测评结果:WA
  • 用时:275ms
  • 内存:3812kb
  • [2023-10-10 19:26:49]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first	
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef long double db;

const int M = 100000;
const db PI = acos(-1.0);
const db T0 = 1.31164152;

void solve()
{
	db v, r, d;
	cin >> v >> r >> d;
	db ans = d / v;
	db t0 = T0 * 2 * r / v;
	const db dt = (ans - t0) / M;
	cerr << t0 << endl;
	if (dt > 0)
	{
		db phiP = PI / 2 - v / (2 * r) * dt, phiPP = PI / 2;
		FOR(i, 2, M + 1)
		{
			db t = i * dt + t0;
			db siP = sin(phiP);
			db der = -v / (2 * r) * (sqrt(3 + siP * siP) - siP);
			db phi = phiPP + 2 * dt * der;
			db a = d - 2 * r - v * t;
			if (a < 0)
				break;
			db si = siP, co = cos(phi);
			db l = sqrt(4 * r * r + a * a - 4 * r * a * co);
			db siBeta = 2 * r * si / l;
			db beta = asin(siBeta);
			if (2 * cos(phi + beta) >= co)
			{
				ans = min(ans, t + l / (2 * v));
				break;	
			}
			phiPP = phiP;
			phiP = phi;
		}
	}
	cout << ans << "\n";
	//cerr << ans - 8.310579933902352 << "\n";
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(15);
	int t;
	cin >> t;
	while (t--)
		solve();
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 5ms
memory: 3708kb

input:

1
2.00 3 30.0

output:

8.310580014534659

result:

ok found '8.3105800', expected '8.3105799', error '0.0000000'

Test #2:

score: -100
Wrong Answer
time: 275ms
memory: 3812kb

input:

100
8.66 6.05 71.59
8.44 8.67 82.55
4.23 9.68 24.74
6.63 9.95 7.45
1.2 7.27 97.55
2.08 2.94 31.61
8.48 5.56 20.16
7.35 5.55 52.48
1.35 8.15 51.23
3.88 9.02 72.37
7.03 1.97 57.03
1.78 4.44 93.44
5.5 6.11 52.94
1.09 9.64 69.01
1.01 3.54 16.78
1.63 4.55 44.06
5.82 5.51 5.92
5.62 2.93 76.01
4.75 4.43 73...

output:

4.457837157451294
5.488360868554391
5.848699763593381
1.123680241327300
43.266480348645566
8.305490210609471
2.377358490566038
4.015486014143252
37.948148148148148
12.329347307802927
4.155123656890546
27.178963125950582
5.845754466009305
47.655062844800005
16.613861386138614
15.093994617509357
1.017...

result:

wrong answer 10th numbers differ - expected: '18.6520619', found: '12.3293473', error = '0.3389821'