QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#170598 | #7184. Transport Pluses | ucup-team1477# | WA | 1ms | 3896kb | C++14 | 1.9kb | 2023-09-09 15:35:57 | 2023-09-09 15:36:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
int n=0,f=1,ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
n=n*10+ch-'0';
ch=getchar();
}
return n*f;
}
int x[105],y[105];
int ak[105],ax[105],ay[105],tmp;
int jdz(int x)
{
if(x<0)return -x;
return x;
}
int main()
{
int n,t;
n=read();
t=read();
int xh,yh,xe,ye;
xh=read();
yh=read();
xe=read();
ye=read();
for(int i=1;i<=n;i++)
{
x[i]=read();
y[i]=read();
}
double ans=sqrt((xh-xe)*(xh-xe)+(yh-ye)*(yh-ye));
tmp=1;
ak[1]=0;
ax[1]=xe;
ay[1]=ye;
for(int i=1;i<=n;i++)
{
int x1=0,y1=0,dj=t;
if(jdz(xh-x[i])<=jdz(yh-y[i]))
{
x1=x[i];
y1=yh;
dj+=jdz(xh-x[i]);
}
else
{
x1=xh;
y1=y[i];
dj+=jdz(yh-y[i]);
}
int x2=0,y2=0;
if(jdz(xe-x[i])<=jdz(ye-y[i]))
{
x2=x[i];
y2=ye;
dj+=jdz(xe-x[i]);
}
else
{
x2=xe;
y2=y[i];
dj=jdz(ye-y[i]);
}
if(dj<ans)
{
ans=dj;
tmp=3;
ak[1]=0;
ax[1]=x1;
ay[1]=y1;
ak[2]=i;
ax[2]=x2;
ay[2]=y2;
ak[3]=0;
ax[3]=xe;
ay[3]=ye;
}
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(i==j)continue;
int x1=0,y1=0,dj=2*t;
if(jdz(xh-x[i])<=jdz(yh-y[i]))
{
x1=x[i];
y1=yh;
dj+=jdz(xh-x[i]);
}
else
{
x1=xh;
y1=y[i];
dj+=jdz(yh-y[i]);
}
int x2=0,y2=0;
if(jdz(xe-x[j])<=jdz(ye-y[j]))
{
x2=x[j];
y2=ye;
dj+=jdz(xe-x[j]);
}
else
{
x2=xe;
y2=y[j];
dj=jdz(ye-y[j]);
}
if(dj<ans)
{
ans=dj;
tmp=4;
ak[1]=0;
ax[1]=x1;
ay[1]=y1;
ak[2]=i;
ax[2]=x[i];
ay[2]=y[j];
ak[3]=j;
ax[3]=x2;
ay[3]=y2;
ak[4]=0;
ax[4]=xe;
ay[4]=ye;
}
}
}
printf("%.9lf\n",ans);
printf("%d\n",tmp);
for(int i=1;i<=tmp;i++)printf("%d %d %d\n",ak[i],ax[i],ay[i]);
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3896kb
input:
1 2 1 1 5 3 6 2
output:
4.000000000 3 0 1 2 1 6 3 0 5 3
result:
ok correct
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3784kb
input:
2 1 1 1 6 1 1 3 6 3
output:
2.000000000 3 0 1 1 1 6 3 0 6 1
result:
wrong answer claimed 2.0000000000, actual 3.0000000000