QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189472#6426. Interested in SkiingC1942huangjiaxuWA 0ms1656kbC++141.2kb2023-09-27 15:45:062023-09-27 15:45:07

Judging History

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

  • [2023-09-27 15:45:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1656kb
  • [2023-09-27 15:45:06]
  • 提交

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;
	}
	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: 1620kb

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: 1352kb

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: 1584kb

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: 1632kb

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: 1656kb

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: 1572kb

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: 1632kb

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: 1608kb

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: -100
Wrong Answer
time: 0ms
memory: 1652kb

input:

4 9 5
-9 -4 -3 0
-6 2 6 2
-6 -6 2 -8
-4 -12 9 -25

output:

3.125000

result:

wrong answer 1st numbers differ - expected: '7.5000000', found: '3.1250000', error = '0.5833333'