QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#196858#7184. Transport Plusesawesomenick1303#WA 0ms3876kbC++201.9kb2023-10-02 01:20:232023-10-02 01:20:23

Judging History

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

  • [2023-10-02 01:20:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3876kb
  • [2023-10-02 01:20:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i <= (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define S second
#define nl "\n"
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int,int> pii;

#define maxn 105
#define inf 1e9

struct node{int x,y;}s,t,p[maxn];
int dis[maxn],pre[maxn],F[maxn],n,T;

inline int calc(node x,node y)
{
	int ret=min(abs(x.x-y.x),abs(x.y-y.y));
	return ret;
}

void solve() {
	cin>>n>>T>>s.x>>s.y>>t.x>>t.y;
	rep(i,1,n) cin>>p[i].x>>p[i].y;

	double dist1=sqrt(pow(s.x-t.x,2)+pow(s.y-t.y,2));
	double dist2=inf,dist3=inf;

	int F2,F31,F32;
	rep(i,1,n)
	{
		int tmp=calc(s,p[i])+calc(t,p[i])+T;
		if(tmp<dist2) dist2=tmp,F2=tmp;
	}

	rep(i,1,n) rep(j,1,n)
	{
		int tmp=calc(s,p[i])+calc(t,p[j])+2*T;
		if(tmp<dist3) dist3=tmp,F31=i,F32=j;
	}

	if(dist1<=dist2 && dist1<=dist3)
	{
		printf("%.3f\n",dist1);
		puts("1");
		printf("0 %d %d\n",t.x,t.y);
	}

	else if(dist2<=dist1 && dist2<=dist3)
	{
		printf("%.3f\n",dist2);
		puts("3");

		if(abs(p[F2].x-s.x)<abs(p[F2].y-s.y))
			cout<<"0 "<<p[F2].x<<" "<<s.y<<endl;
		else cout<<"0 "<<s.x<<" "<<p[F2].y<<endl;

		if(abs(p[F2].x-t.x)<abs(p[F2].y-t.y))
			printf("%d %d %d\n",F2,t.x,p[F2].y);
		else printf("%d %d %d\n",F2,p[F2].x,t.y);
		printf("0 %d %d\n",t.x,t.y);
	}

	else
	{
		printf("%.3f\n",dist3);
		puts("4");
		if(abs(p[F31].x-s.x)<abs(p[F31].y-s.y))
			printf("0 %d %d\n",s.x,p[F31].y);
		else printf("0 %d %d\n",p[F31].x,s.y);
		
		cout<<F31<<" "<<p[F31].x<<" "<<p[F32].y<<endl;

		if(abs(p[F32].x-t.x)<abs(p[F32].y-t.y))
			printf("%d %d %d\n",F32,p[F32].x,t.y);
		else printf("%d %d %d\n",F32, t.x,p[F32].y);
		printf("0 %d %d\n",t.x,t.y);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3876kb

input:

1 2
1 1
5 3
6 2

output:

0 1 0
4.000
3
4 0 3
0 5 3

result:

wrong answer arrived at (4.000000, 3.000000) instead of (5.000000, 3.000000)