QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#189479 | #6426. Interested in Skiing | C1942huangjiaxu | AC ✓ | 2ms | 1660kb | C++14 | 1.2kb | 2023-09-27 15:53:05 | 2023-09-27 15:53:06 |
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 1ll*cros(A.a-B.a,B.b-B.a)*cros(A.b-B.a,B.b-B.a)<0&&1ll*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;
}
if(check(line{po{0,(int)2e4},po{0,(int)-2e4}}))ans=0;
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){
if(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(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: 1628kb
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: 1348kb
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: 1624kb
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: 1632kb
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: 1588kb
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: 1660kb
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: 1632kb
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: 0
Accepted
time: 0ms
memory: 1652kb
input:
3 9 10 -9 -26 0 -8 -6 -6 6 6 9 26 0 8
output:
30.000000
result:
ok found '30.0000000', expected '30.0000000', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 1636kb
input:
3 9 10 -9 26 0 8 -6 6 6 -6 9 -26 0 -8
output:
30.000000
result:
ok found '30.0000000', expected '30.0000000', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 1656kb
input:
4 9 5 -9 -4 -3 0 -6 2 6 2 -6 -6 2 -8 -4 -12 9 -25
output:
7.500000
result:
ok found '7.5000000', expected '7.5000000', error '0.0000000'
Test #11:
score: 0
Accepted
time: 1ms
memory: 1616kb
input:
100 10000 2 1663 -5179 1091 -542 -5687 -1048 7838 4346 3959 -2780 1099 -9402 -8661 -856 3945 7651 -1688 5290 -3518 2625 10000 -8028 5857 -9678 -9929 4601 -6350 3819 -1173 -9608 -2422 -9939 10000 -4668 5423 -2597 -572 -9335 -5787 -7658 -10000 1589 3117 9331 9818 4874 1345 1669 9026 -8243 2952 -6411 8...
output:
5.977608
result:
ok found '5.9776080', expected '5.9776075', error '0.0000001'
Test #12:
score: 0
Accepted
time: 0ms
memory: 1660kb
input:
20 100 5 100 55 77 -18 60 -33 45 -1 41 41 -84 53 66 -77 30 -70 44 -15 -45 -98 -36 19 67 29 51 -71 89 -50 100 -48 92 -39 43 20 -22 -33 10 -71 7 -52 -100 -9 -4 13 -100 90 -19 81 73 67 6 54 -86 2 -91 67 59 -35 77 -55 -43 -40 -58 -41 100 82 -39 55 40 -17 39 -12 42 4 84 -52 61 78 -46 86
output:
27.000000
result:
ok found '27.0000000', expected '27.0000000', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 1596kb
input:
20 100 1 90 -37 -90 90 -61 46 -83 42 26 -45 -89 -79 -100 -3 -51 -34 40 -57 22 -70 90 55 17 75 5 -50 -35 24 -1 -20 33 -19 -69 78 100 -13 -45 -52 -89 -15 100 -100 -3 -23 49 84 78 95 -48 43 -21 -23 100 53 78 84 65 -42 84 -61 100 23 100 19 -58 38 -48 18 26 -53 -51 -92 29 37 -81 90 -5 82 43 30
output:
1.318182
result:
ok found '1.3181820', expected '1.3181818', error '0.0000001'
Test #14:
score: 0
Accepted
time: 1ms
memory: 1608kb
input:
100 10000 9 9893 -5 -4023 94 2920 -32 -2174 -97 7462 24 4169 40 -6157 -25 -6492 40 5908 -16 647 48 4128 -19 -5163 -5 4082 96 7645 37 -8896 29 -2485 59 165 1 -1634 59 7644 -64 6345 -96 -8569 46 -5850 72 -2219 -64 -5429 -13 641 -36 -3923 -25 -1947 6 -3957 43 8241 -6 -2456 77 5268 -95 890 -75 3296 78 -...
output:
3037.153846
result:
ok found '3037.1538460', expected '3037.1538462', error '0.0000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 1612kb
input:
10 50 4 5 -45 22 -48 -50 20 -23 19 -43 -29 35 31 50 -33 40 48 -49 -32 0 -33 16 -50 21 -49 50 -38 -22 -18 -49 50 11 14 20 -23 16 -11 -27 -15 35 32
output:
3.354839
result:
ok found '3.3548390', expected '3.3548387', error '0.0000001'
Test #16:
score: 0
Accepted
time: 0ms
memory: 1612kb
input:
10 50 1 -50 -3 28 -3 7 -30 2 -30 34 39 50 39 16 22 43 22 50 -32 7 -32 50 15 -2 15 -15 -42 24 -42 14 -26 28 -26 23 -10 -39 -10 50 -44 -31 -44
output:
1.666667
result:
ok found '1.6666670', expected '1.6666667', error '0.0000002'
Test #17:
score: 0
Accepted
time: 0ms
memory: 1604kb
input:
10 50 2 35 10 7 22 -47 -23 -34 8 44 27 14 47 50 -13 -43 -48 44 -15 20 -12 -42 -34 11 -5 50 -5 -32 19 17 -39 46 -27 50 -2 11 20 -1 29 30 31
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #18:
score: 0
Accepted
time: 2ms
memory: 1648kb
input:
100 10000 10 0 9993 -10000 9997 -8432 1663 -4444 1091 -6362 3959 -103 1099 -6051 -8548 -5705 -3821 -1799 4343 -9251 8281 -10000 -1137 -6247 718 -10000 -1352 -641 -1609 -2741 -1688 -2924 -3518 -10000 5035 -7198 5857 -4181 -9929 -3009 -6350 -9568 -9578 -7653 -9810 -9208 2799 -8703 3189 -10000 -3228 -3...
output:
0.001501
result:
ok found '0.0015010', expected '0.0015005', error '0.0000005'
Test #19:
score: 0
Accepted
time: 0ms
memory: 1660kb
input:
7 70 6 -63 -598 7 -598 70 260 14 104 35 26 -21 -182 -21 -286 -21 -494 -56 -208 -56 -572 -70 0 0 0 -42 -208 -14 -208
output:
1.615385
result:
ok found '1.6153850', expected '1.6153846', error '0.0000002'
Test #20:
score: 0
Accepted
time: 0ms
memory: 1636kb
input:
1 10 1 -10 0 -10 10
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #21:
score: 0
Accepted
time: 0ms
memory: 1616kb
input:
2 3 1 2 0 2 3 -3 1 2 100
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #22:
score: 0
Accepted
time: 0ms
memory: 1336kb
input:
3 3 1 -3 -3 2 -1 0 -1 0 2 -2 2 3 5
output:
-1
result:
ok found '-1.0000000', expected '-1.0000000', error '-0.0000000'
Test #23:
score: 0
Accepted
time: 0ms
memory: 1580kb
input:
3 3 1 -3 -3 2 -1 0 0 0 2 -2 2 3 5
output:
2.000000
result:
ok found '2.0000000', expected '2.0000000', error '0.0000000'
Test #24:
score: 0
Accepted
time: 0ms
memory: 1596kb
input:
5 3 1 -3 -3 0 0 0 -4 3 -4 0 1 0 2 0 -1 0 -2 0 -9 0 -1000
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'