QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#509572#8022. WalkerXunwuqishi#WA 0ms3936kbC++201.5kb2024-08-08 16:09:282024-08-08 16:09:28

Judging History

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

  • [2024-08-08 16:09:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3936kb
  • [2024-08-08 16:09:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) x&(-x)
#define int long long
#define double long double

const int N = 2e5+10;
double INF  = 1e9;
int mod = 1e6+7;

double n,a,b,av,bv,ans;

void solve() {

    cin>>n>>a>>av>>b>>bv;

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

    double t;

    ans = 4e18l;

    ans = fmin(ans,(n + n - a) / av);
    ans = fmin(ans,(n + n - b) / bv);
    
    ans = fmin(ans,(a + n) / av);
    ans = fmin(ans,(b + n) / bv);

    ans = fmin(ans,fmax((n - a) / av,(b / bv)));
    
    ans = fmin(ans,fmax((n - b) / bv,(b + a) / av));
    ans = fmin(ans,fmax(a / av,(n - b + n - a) / bv));
    
    ans = fmin(ans,fmax((n - b) / bv,(b - a + b - a + a) / av));
    ans = fmin(ans,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);
    	ans = fmin(ans,tt + (n - x) / (av + bv));
	}else
	{
		double tt = (n - b) / bv;
		double x = tt * av - a;
		ans = fmin(ans,tt + (n - x) / (av + bv));
	}


    double xx = (av * (2.0 * (b - a) + n - b) - a * bv) / (2.0 * (av + bv));
    
    
	ans = fmin(ans,(2 * xx + a) / av);
	
    cout<<ans<<endl;


}
signed main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(10);
    int caset = 1;
    cin>>caset;

    for(int i = 1;i<=caset;i++)
	{
		solve();
	}

    return 0;
}

詳細信息

Test #1:

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

input:

2
10000.0 1.0 0.001 9999.0 0.001
4306.063 4079.874 0.607 1033.423 0.847

output:

5001000.0000000000
3827.8370013755

result:

ok 2 numbers

Test #2:

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

input:

1
10.0 1.0 10.0 9.0 0.1

output:

1.1000000000

result:

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

Test #3:

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

input:

1
10.0 8.0 10.0 9.0 0.1

output:

1.0891089109

result:

wrong answer 1st numbers differ - expected: '1.2000000', found: '1.0891089', error = '0.0924092'