QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189464 | #6426. Interested in Skiing | C1942huangjiaxu | WA | 0ms | 1660kb | C++14 | 1.2kb | 2023-09-27 15:34:26 | 2023-09-27 15:34:27 |
Judging History
answer
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
typedef long double lf;
int n,m,V,cp;
lf f[205],ans=1e9;
struct po{
int x,y;
po operator -(po a){return po{x-a.x,y-a.y};}
bool operator <(const po a)const{return y<a.y;}
}p[205];
struct line{
po a,b;
}l[105];
int cros(po a,po b){
return a.x*b.y-a.y*b.x;
}
bool cros(line A,line B){
return cros(A.a-B.a,B.b-B.a)*cros(A.b-B.a,B.b-B.a)<0&&cros(B.a-A.a,A.b-A.a)*cros(B.b-A.a,A.b-A.a)<0;
}
bool check(line A){
for(int i=1;i<=n;++i)if(cros(l[i],A))return false;
return true;
}
int main(){
scanf("%d%d%d",&n,&m,&V);
for(int i=1;i<=n;++i){
scanf("%d%d%d%d",&l[i].a.x,&l[i].a.y,&l[i].b.x,&l[i].b.y);
p[++cp]=l[i].a,p[++cp]=l[i].b;
}
sort(p+1,p+cp+1);
for(int i=1;i<=cp;++i)f[i]=1e9;
for(int i=1;i<=cp;++i){
if(abs(p[i].x)!=m&&check(line{p[i],po{p[i].x,(int)-2e4}}))f[i]=0;
for(int j=i+1;j<=cp;++j)if(p[j].y!=p[i].y&&check(line{p[j],p[i]}))f[j]=min(f[j],max(f[i],fabsl(lf(p[i].x-p[j].x)/(p[i].y-p[j].y))));
if(abs(p[i].x)!=m&&check(line{p[i],po{p[i].x,(int)2e4}}))ans=min(ans,f[i]);
}
if(ans>1e8)return puts("-1"),0;
printf("%Lf\n",ans*V);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 1600kb
input:
3 2 1 -2 0 1 0 -1 4 2 4 0 1 0 3
output:
1.000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 1344kb
input:
2 1 2 -1 0 1 0 1 1 0 1
output:
-1
result:
ok found '-1.0000000', expected '-1.0000000', error '-0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 1660kb
input:
2 3 7 -3 0 2 2 3 1 -2 17
output:
1.866667
result:
ok found '1.8666670', expected '1.8666667', error '0.0000002'
Test #4:
score: 0
Accepted
time: 0ms
memory: 1604kb
input:
1 100 1 -100 0 99 0
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 1612kb
input:
3 8 3 -8 -9 0 -9 -6 -6 6 6 8 9 0 9
output:
6.000000
result:
ok found '6.0000000', expected '6.0000000', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 1576kb
input:
3 8 3 -8 9 0 9 -6 6 6 -6 8 -9 0 -9
output:
6.000000
result:
ok found '6.0000000', expected '6.0000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 1660kb
input:
2 1 2 -1 0 0 0 1 1 0 1
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #8:
score: -100
Wrong Answer
time: 0ms
memory: 1628kb
input:
3 9 10 -9 -26 0 -8 -6 -6 6 6 9 26 0 8
output:
0.000000
result:
wrong answer 1st numbers differ - expected: '30.0000000', found: '0.0000000', error = '1.0000000'