QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#708990#8022. WalkeroqmsacWA 0ms3936kbC++231.5kb2024-11-04 10:33:442024-11-04 10:33:45

Judging History

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

  • [2024-11-04 10:33:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3936kb
  • [2024-11-04 10:33:44]
  • 提交

answer

#include<bits/stdc++.h>

#define ll  long long
#define ull unsigned long long
#define ld long double
#define pii pair<ll,ll>
using namespace std;
#pragma GCC optimize(3)
#define N 100005
struct Node
{
    vector<string> s;
    vector<int> type;
    vector<int> e;
};
ll tot=1;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // freopen("")
    int T;
    cin>>T;
    while(T--)
    {
        ld n,p1,p2,v1,v2;
        cin>>n>>p1>>v1>>p2>>v2;
        if(p1>p2)
        {
            swap(p1,p2);
            swap(v1,v2);
        }
        ld ans=(n+min(p1,n-p1))/v1;
        ld t2=(n+min(p2,n-p2))/v2;
        ans=min(ans,t2);
        ld t3=(n*2+p1-p2)/(v1+v2);
        ans=min(t3,ans);
        ld t4=max(p1/v1,(n-p2+n-p1)/v2);
        ans=min(ans,t4);
        ld t5=max((n-p2)/v2,(p1+p2)/v1);
        ans=min(ans,t5);
        ld t6=max(p2/v2,(n-p1)/v1);
        ans=min(ans,t6);
        ld t7=max((n+p2-p1)/(v2+v1),max(p1/v1,(n-p2)/v2));
        ans=min(t7,ans);
        ld t8=max(p1/v1,(n+p2-p1-p1)/v2);
        ans=min(ans,t8);
        ld t9=max((n-p2)/v2,((p2+p2-p1)/v1));
        ans=min(ans,t9);
        ld x=(v2*(p1+p2)-v1*(n-p2))/(v1*2+v2);
        if(x>=0&&x<=p2-p1)
        {
            ld tt=(x*2+n-p2)/v2;
            ans=min(ans,tt);
        }
        ld y=(v1*(n*2-p1-p2)-v2*p1)/(v1+v2*2);
        if(y>=0&&y<=p2-p1)
        {
            ld tt=(x*2+p1)/v1;
            ans=min(ans,tt);
        }
        cout<<setprecision(15)<<ans<<endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
10000.0 1.0 0.001 9999.0 0.001
4306.063 4079.874 0.607 1033.423 0.847

output:

5001000
3827.83700137552

result:

ok 2 numbers

Test #2:

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

input:

1
10.0 1.0 10.0 9.0 0.1

output:

1.1

result:

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

Test #3:

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

input:

1
10.0 8.0 10.0 9.0 0.1

output:

1.2

result:

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

Test #4:

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

input:

1
10.0 8.0 0.1 9.0 10

output:

1.1

result:

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

Test #5:

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

input:

1
10.0 2.0 0.1 3.0 10

output:

1.3

result:

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

Test #6:

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

input:

1
10.0 9.0 0.1 8.0 10.0

output:

1.2

result:

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

Test #7:

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

input:

1
10.0 4.0 0.1 6.0 0.1

output:

60

result:

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

Test #8:

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

input:

1
10.0 4.5 0.1 6.0 0.1

output:

57.5

result:

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

Test #9:

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

input:

1
10.0 1.0 1.0 8.0 1.0

output:

5.66666666666667

result:

wrong answer 1st numbers differ - expected: '6.5000000', found: '5.6666667', error = '0.1282051'