QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#621037#8022. WalkerXunwuqishiWA 14ms3952kbC++232.2kb2024-10-08 00:46:212024-10-08 00:46:22

Judging History

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

  • [2024-10-08 00:46:22]
  • 评测
  • 测评结果:WA
  • 用时:14ms
  • 内存:3952kb
  • [2024-10-08 00:46:21]
  • 提交

answer

#include<bits/stdc++.h>
#define Alex std::ios::sync_with_stdio(false),std::cin.tie(0),std::cout.tie(0);
#define int long long
//#define double
const int QAQ = 0;
const int mod = 1e9 + 7;
const int P = 998244353;
const double pi = std::acos(-1.0);
const double eps = 1e-10;
const int G = 3;
const int Gi = 332748118; 
const int N = 5002105;
std::mt19937 doge;

inline void Fre() {	int liujiahui = 142857; }

void solve() {
	
    double n,a,b,av,bv,ans;
    std::cin>>n>>a>>av>>b>>bv;

    if(a > b)
	{
        std::swap(a,b);
        std::swap(av,bv);
    }

    ans = 4e18l;

    ans = std::fmin(ans,(n + n - a) / av);
    ans = std::fmin(ans,(n + n - b) / bv);
    
    ans = std::fmin(ans,(a + n) / av);
    ans = std::fmin(ans,(b + n) / bv);
    
    double t = (b - a) / (av + bv);
    
    ans = std::fmin(ans,t + std::fmax((n - b + t * bv) / av,(a + t * av) / bv));
    
    ans = std::fmin(ans,std::fmax((n - b) / bv,(b + a) / av));
    ans = std::min(ans,std::fmax(a / av,(n - b + n - a) / bv));
    
    ans = std::fmin(ans,std::fmax((n - b) / bv,(b - a + b - a + a) / av));
    ans = std::fmin(ans,std::fmax(a / av,(b - a + b - a + n - b) / bv));
    
    if(a / av > (n - b) / bv)
    {
    	double tt = a / av;
    	double x = tt * bv - (n - b);
    	double xx = (av * (n - a - x) - a * bv) / (av + bv);
    	ans = std::fmin(ans,tt + (a + xx) / av);
	}else
	{
		double tt = (n - b) / bv;
		double x = tt * av - a;
		double xx = (av * (n - a) - bv * (a - x)) / (av + bv);
		ans = std::fmin(ans,tt + (a - x + xx) / av);
	}


    double xx = (av * (2.0 * (b - a) + n - b) - a * bv) / (2.0 * (av + bv));
    if(xx >= 0.0 && xx <= b - a)
    {
    	ans = std::fmin(ans,(2 * xx + a) / av);
	}
	
	       xx = (av * (2.0 * (b - a) + n - b) - 2.0 * a * bv) / (2.0 * av + bv);
	if(xx >= 0.0 && xx <= b - a)
	{
		ans = std::fmin(ans,(2 * a + xx) / av);
	}
	
	       xx = ((b - a + 2.0 * (n - b)) * av - a * bv) / (av + 2.0 * bv);
	if(xx >= 0.0 && xx <= b - a)
	{
		ans = std::fmin(ans,(a + 2 * xx) / av);
	}
	std::cout<<ans<<'\n';


}
signed main() 
{
	Fre();
    Alex;
    std::cout<<std::fixed<<std::setprecision(5);
    int _;
    std::cin>>_;
    while(_--) solve();
    return QAQ;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
10000.0 1.0 0.001 9999.0 0.001
4306.063 4079.874 0.607 1033.423 0.847

output:

5001000.00000
3827.83700

result:

ok 2 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

1
10.0 1.0 10.0 9.0 0.1

output:

1.10000

result:

ok found '1.1000000', expected '1.1000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

1
10.0 8.0 10.0 9.0 0.1

output:

1.20000

result:

ok found '1.2000000', expected '1.2000000', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

1
10.0 8.0 0.1 9.0 10

output:

1.10000

result:

ok found '1.1000000', expected '1.1000000', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

1
10.0 2.0 0.1 3.0 10

output:

1.30000

result:

ok found '1.3000000', expected '1.3000000', error '0.0000000'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

1
10.0 9.0 0.1 8.0 10.0

output:

1.20000

result:

ok found '1.2000000', expected '1.2000000', error '0.0000000'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

1
10.0 4.0 0.1 6.0 0.1

output:

60.00000

result:

ok found '60.0000000', expected '60.0000000', error '0.0000000'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

1
10.0 4.5 0.1 6.0 0.1

output:

57.50000

result:

ok found '57.5000000', expected '57.5000000', error '0.0000000'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

1
10.0 1.0 1.0 8.0 1.0

output:

6.50000

result:

ok found '6.5000000', expected '6.5000000', error '0.0000000'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

1
10.0 3.0 2.0 7.0 1.0

output:

4.60000

result:

ok found '4.6000000', expected '4.6000000', error '0.0000000'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3904kb

input:

1
10.0 6.0 2.0 7.0 1.0

output:

3.66667

result:

ok found '3.6666700', expected '3.6666667', error '0.0000009'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3912kb

input:

1
10.0 1.0 1.0 9.0 1.0

output:

6.00000

result:

ok found '6.0000000', expected '6.0000000', error '0.0000000'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

1
10000.0 1.0 0.001 1.0 0.001

output:

9999000.00000

result:

ok found '9999000.0000000', expected '9999000.0000000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

1
10.0 5.0 1.0 5.0 1.5

output:

5.00000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #15:

score: 0
Accepted
time: 14ms
memory: 3824kb

input:

10000
4306.063 4079.874 0.607 1033.423 0.847
8967.336 8026.500 0.398 283.019 0.876
9568.147 4481.616 0.405 800.114 0.684
9867.264 6184.040 0.312 9853.164 0.641
3344.364 730.612 0.539 1305.868 0.947
9336.180 3672.113 0.773 432.686 0.312
1468.243 59.762 0.840 1438.446 0.827
1355.133 1096.314 0.373 109...

output:

3827.83700
7999.36499
12559.33580
15371.55070
2637.69852
9931.04152
934.49430
2939.17962
5754.03289
2847.42716
10975.32363
2180.27861
23747.04545
6278.10355
872.39771
10734.39564
1005.07703
20225.16309
9878.00995
22899.25926
12241.08593
33365.47619
3153.05873
11691.59763
20162.71115
6052.69672
5846....

result:

ok 10000 numbers

Test #16:

score: -100
Wrong Answer
time: 13ms
memory: 3716kb

input:

10000
2030.871 179.860 3.339 226.899 5.608
4013.779 5.483 5.886 2655.711 6.577
2948.361 1567.653 5.641 1789.794 4.572
1539.149 427.003 6.957 936.942 3.945
1689.115 359.356 1.192 742.725 8.260
2381.830 1935.542 7.989 1021.393 9.984
2247.138 2095.797 6.333 411.074 8.188
4141.126 403.006 1.882 3801.489...

output:

321.67832
364.07739
310.43787
186.46604
294.41162
178.52411
193.48206
556.83279
1413.56370
403.23023
743.59151
396.62882
209.13011
611.28507
4769.78107
631.17553
679.60399
2239.79251
672.22649
652.93272
1108.77182
362.00739
602.39813
175.93697
1171.48177
165.12054
510.48568
87.69566
403.76933
1736.4...

result:

wrong answer 1972nd numbers differ - expected: '0.4297319', found: '0.4297300', error = '0.0000019'