QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#163099#7110. Kuririn MIRACLEucup-team1325AC ✓95ms4452kbC++171.8kb2023-09-03 20:41:062023-09-03 20:41:07

Judging History

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

  • [2023-09-03 20:41:07]
  • 评测
  • 测评结果:AC
  • 用时:95ms
  • 内存:4452kb
  • [2023-09-03 20:41:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef long long ll; typedef unsigned long long ull;
const int inf = 1e9; const ll llnf = 4e18;

template< class Tp > void chkmax( Tp &x , Tp y ) { x = max( x , y ); }
template< class Tp > void chkmin( Tp &x , Tp y ) { x = min( x , y ); }

double pi = acos( -1.0 );

void solve( ) {
	double v , r , d; cin >> v >> r >> d;

	auto simpson = [&] ( auto f , double l , double r ) -> double {
		auto calc = [&] ( double l , double r ) -> double { return ( f( l ) + f( r ) + 4 * f( ( l + r ) / 2 ) ) * ( r - l ) / 6; } ;
		auto F = [&] ( auto F , double l , double r , double eps = 1e-8 ) -> double {
			double S = calc( l , r ) , lS = calc( l , ( l + r ) / 2 ) , rS = calc( ( l + r ) / 2 , r );
			if( abs( lS + rS - S ) <= 15 * eps ) return lS + rS + ( lS + rS - S ) / 15;
			else return F( F , l , ( l + r ) / 2 , eps / 2 ) + F( F , ( l + r ) / 2 , r , eps / 2 );
		} ;
		return F( F , l , r );
	} ;

	auto check = [&] ( double t ) -> bool {
		double R = 2 * r; double X = d - v * t; if( X < 2 * R ) return false;

		auto f = [&] ( double theta ) -> double { return 1 / ( sqrt( sin( theta ) * sin( theta ) + 3 ) - sin( theta ) ); } ;
		double phi = pi - acos( R / ( X - R ) );
		double sum = ( R * simpson( f , 0 , phi ) + f( phi ) * sqrt( pow( X - R + R * cos( phi ) , 2 ) + pow( R * sin( phi ) , 2 ) ) ) / v;
		return sum <= t;
	} ;

	double lef = 0.0 , rig = ( d - 4 * r ) / v , ans = d / v;
	if( lef <= rig ) for( int T = 1; T <= 80; T ++ ) { double mid = ( lef + rig ) / 2; ( check( mid ) ) ? ( rig = mid , ans = mid ) : ( lef = mid ); }
	cout << fixed << setprecision( 15 ) << ans << "\n";
}

int main( ) {
	ios::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 );
	int T; cin >> T; while( T -- ) solve( ); return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

input:

1
2.00 3 30.0

output:

8.310579933901417

result:

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

Test #2:

score: 0
Accepted
time: 11ms
memory: 4412kb

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.457837122734279
5.488360808985134
5.848699763593380
1.123680241327300
43.266480053516894
8.305490138200348
2.377358490566038
4.015485969498591
37.948148148148142
18.652061855670105
4.155123643569373
27.178963006984645
9.625454545454545
63.311926605504588
16.613861386138616
15.093994461129432
1.017...

result:

ok 100 numbers

Test #3:

score: 0
Accepted
time: 95ms
memory: 4452kb

input:

1000
7.52 6.68 80.67
5.34 6.82 45.75
3.57 6.35 22.35
9.55 3.65 31.38
9.37 5.73 40.42
1.83 8.38 82.97
4.86 6.13 9.45
3.88 5.34 84.19
6.49 4.15 85.24
6.51 7.23 42.97
3.0 5.98 57.53
9.35 2.76 69.07
6.76 9.16 91.24
2.98 9.89 49.2
9.16 3.85 66.14
1.84 3.03 37.43
8.01 5.04 50.98
4.05 9.86 4.76
5.4 5.49 60...

output:

5.770882649249244
8.567415730337078
6.260504201680673
3.285863874345549
4.313767342582711
25.176484172017581
1.944444444444444
11.406299616369447
6.807191205631123
6.600614439324117
10.727712560806809
3.800197844811761
7.484484302619514
16.510067114093960
3.775697012154373
10.915711070450335
3.51752...

result:

ok 1000 numbers

Extra Test:

score: 0
Extra Test Passed