QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#875290 | #7184. Transport Pluses | shinonome_ena# | WA | 1ms | 3968kb | C++14 | 1.8kb | 2025-01-29 15:02:23 | 2025-01-29 15:02:25 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double lf;
ll n,m,i,j,k,l,r,x,y,z,w;
lf s,t,ans,ww,zz,xx,yy,stx,sty,edx,edy;
pair<lf,lf> p[110000];
pair<ll,ll> pp,qq;
lf f(ll i)
{
if(abs(stx-p[i].first)>abs(sty-p[i].second))
{
pp={ll(stx),ll(p[i].second)};
}
else
{
pp={ll(p[i].first),ll(sty)};
}
return min(abs(stx-p[i].first),abs(sty-p[i].second));
}
lf g(ll i)
{
if(abs(edx-p[i].first)>abs(edy-p[i].second))
{
qq={ll(edx),ll(p[i].second)};
}
else
{
qq={ll(p[i].first),ll(edy)};
}
return min(abs(edx-p[i].first),abs(edy-p[i].second));
}
int main()
{
scanf("%lld %lf",&n,&t);
scanf("%lf %lf",&stx,&sty);
scanf("%lf %lf",&edx,&edy);
for(i=1;i<=n;i++)
{scanf("%lf %lf",&xx,&yy);
p[i]={xx,yy};
}
ans=sqrt((stx-edx)*(stx-edx)+(sty-edy)*(sty-edy));
ww=f(1);
zz=g(1);
for(i=1;i<=n;i++)
{
ww=min(ww,f(i));
zz=min(zz,g(i));
ans=min(ans,f(i)+g(i)+t);
}
ans=min(ans,ww+zz+t*lf(2));
printf("%lf\n",ans);
if(ans==sqrt((stx-edx)*(stx-edx)+(sty-edy)*(sty-edy)))
{
printf("1\n0 %lld %lld",ll(edx),ll(edy));
return 0;
}
for(i=1;i<=n;i++)
{
if(ans==(f(i)+g(i)+t))
{
printf("3\n0 %lld %lld\n%lld %lld %lld\n0 %lld %lld",pp.first,pp.second,i,qq.first,qq.second,ll(edx),ll(edy));
return 0;
}
if(f(i)==ww)
w=i;
if(g(i)==zz)
z=i;
}
f(w);
g(z);
printf("4\n0 %lld %lld\n%lld %lld %lld\n%lld %lld %lld\n0 %lld %lld",pp.first,pp.second,w,ll(p[w].first),ll(p[z].second),z,qq.first,qq.second,ll(edx),ll(edy));
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3968kb
input:
1 2 1 1 5 3 6 2
output:
4.000000 3 0 1 2 1 6 3 0 5 3
result:
ok correct
Test #2:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
2 1 1 1 6 1 1 3 6 3
output:
2.000000 4 0 1 1 1 1 3 2 6 1 0 6 1
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
0 0 1 1 1 1
output:
0.000000 1 0 1 1
result:
ok correct
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3968kb
input:
0 0 100 100 0 0
output:
100.000000 4 0 0 100 0 0 0 0 0 0 0 0 0
result:
wrong answer claimed 100.0000000000, actual 200.0000000000