QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#239743 | #5505. Great Chase | KLPP# | WA | 0ms | 3880kb | C++20 | 1.2kb | 2023-11-04 22:56:10 | 2023-11-04 22:56:10 |
Judging History
answer
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int lld;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
#define all(x) begin(x),end(x)
void solve(){
int n;
long double v;
cin>>n>>v;
vector<array<long double,2>> a(n);
for(auto&[i,j]:a)cin>>i>>j;
int iters=200;
long double L=0;
long double R=1e12;
while(iters--){
long double mid=(L+R)/2;
bool leftDefined=false;
bool rightDefined=false;
long double posLeft;
long double posRight;
for(auto[x,y]:a){
if(x<0){
if(!leftDefined){
leftDefined=true;
posLeft=x+mid*y;
}
else posLeft=max(posLeft,x+mid*y);
}
else{
if(!rightDefined){
rightDefined=true;
posRight=x-mid*y;
}
else posRight=min(posRight,x-mid*y);
}
}
if(posLeft>posRight)R=mid;
else L=mid;
}
cout<<fixed<<(v*L)<<"\n";
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int tt=1;
cin>>tt;
while(tt--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3880kb
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.250000 1.230769 3000000000000.000000
result:
wrong answer 2nd numbers differ - expected: '1.2307692', found: '1.2307690', error = '0.0000002'