QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#113178 | #5505. Great Chase | lftroq | WA | 7ms | 5760kb | C++14 | 2.3kb | 2023-06-16 16:41:38 | 2023-06-16 16:41:40 |
Judging History
answer
/*
,
,. | \
|: \ ; :\
:' ;\| ::\
\ : | `::\
_) | `:`.
,' , `. ;: ;
,' ;: ;"' ,:: |_
/, ` . ;::: |:`-.__
_,' _o\ ,::.`:' ; ; . '
_,-' `:. ;""\,
,-' ,: `-;,
\, ;: ;--._
`.______,-,----._ ,' ;: ,/ , ,`
/ /,-';' \ ; `: ,'/,::.:::
,',;-'-'_,--; ; :. ,',',;::::::
( /___,-' `. ;::,,'o/ ,:::::::
`' ) ;:,'o / ;"- -::
\__ _,'o ,' ,::
) `--' ,..::::
_lftroq_ ; `. ,:::::::
; ``::. :::::::
*/
#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007LL
#define MOD2 998244353LL
#define endl '\n'
#define INFINITE 2147483647LL
#define INFINITE2 9223372036854775807
#define llll pair<ll,ll>
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;
ll n,v;
ll a[400005],b[400005];
ld l,r,ma,mi;
bool check(ld k)
{
//cout << k << ": ";
ld x=-INFINITE2,y=INFINITE2;
for(int i=1;i<=n;i++)
{
if(a[i]<=0) x=max(x,a[i]+k*b[i]);
else y=min(y,a[i]-k*b[i]);
}
//cout << x << " " << y << endl;
if(x>=y) return false;
return true;
}
void solve()
{
ld ans=0;
l=r=ma=mi=0;
cin >> n >> v;
for(int i=1;i<=n;i++)
{
cin >> a[i] >> b[i];
ma=max(ma,(ld)a[i]);
mi=min(mi,(ld)a[i]);
}
l=0,r=ma-mi;
ll temp=0;
while(l<=r&&temp<=1000000)
{
ld mid=(l+r)/2.0;
if(check(mid))
{
ans=mid;
l=mid+0.00000001;
}
else r=mid-0.00000001;
temp+=n;
}
cout << setprecision(15) << fixed << ans*v << endl;
}
int main()
{
fastIO
//freopen("hanhhhh.inp","r",stdin);
//freopen("hanhhhh.out","w",stdout);
ll t=1;
cin >> t;
while(t--)
solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 7ms
memory: 5760kb
input:
3 4 9 10 2 -7 2 -6 1 7 1 2 8 -1 7 1 6 2 3 -1000000000000 1 1000000000000 1
output:
38.249999955000000 1.230769208926650 2999999999999.999999761581421
result:
wrong answer 2nd numbers differ - expected: '1.2307692', found: '1.2307692', error = '0.0000000'