QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#171115#7184. Transport Plusesucup-team994#WA 2ms8384kbC++982.2kb2023-09-09 16:29:152023-09-09 16:29:17

Judging History

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

  • [2023-09-09 16:29:17]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:8384kb
  • [2023-09-09 16:29:15]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define x first
#define y second
# define pii pair<int,int>
const int N=2e5+10;
using namespace std;
double ans;
int ans_type,ans_posa,ans_posb;
int t,n,x,mx;
pii s,e;
pair<pii,int> q[N];
void ww(int x) {
	cout << "part-" << x << "\n";
}
main() {
	ios::sync_with_stdio(0);
	ans=1e9;
	cin.tie(0);
//	cout << fixed << setpresicion(10) << ;
	cin >> n >> t;
	cin >> s.x >> s.y >> e.x >> e.y;
	rep(i,1,n) cin >> q[i].x.x >> q[i].x.y,q[i].y=i;
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++) {
			if(i!=j) {
				int diss=min(abs(q[i].x.x-s.x),abs(q[i].x.y-s.y)),dist=min(abs(q[j].x.x-e.x),abs(q[j].x.y-e.y));
				if(ans>(double)diss+dist+2*t) {
					ans_type=2;
					ans_posa=i;
					ans_posb=j;
					ans=(double)diss+dist+2*t;
				}
			}
		}
	for(int i=1; i<=n; i++) {
		int diss=min(abs(q[i].x.x-s.x),abs(q[i].x.y-s.y)),dist=min(abs(q[i].x.x-e.x),abs(q[i].x.y-e.y));
		if(ans>(double)diss+dist+t) {
			ans_type=1;
			ans_posa=i;
			ans=(double)diss+dist+t;
		}
	}
	if(sqrt((s.x-e.x)*(s.x-e.x)+(s.y-e.y)*(s.y-e.y))<ans) {
		cout<<sqrt((s.x-e.x)*(s.x-e.x)+(s.y-e.y)*(s.y-e.y))<<'\n';
		cout<<1<<'\n';
		cout<<0<<" "<<e.x<<" "<<e.y<<'\n';
	} else {
		if(ans_type==1) {
			cout<<ans<<'\n';
			cout<<3<<'\n';
			if(abs(q[ans_posa].x.x-s.x)<=abs(q[ans_posa].x.y-s.y))cout<<0<<" "<<q[ans_posa].x.x<<" "<<s.y<<'\n';
			else cout<<0<<" "<<s.x<<" "<<q[ans_posa].x.y<<'\n';
			if(abs(q[ans_posa].x.x-e.x)<=abs(q[ans_posa].x.y-e.y))cout<<1<<" "<<q[ans_posa].x.x<<" "<<e.y<<'\n';
			else cout<<1<<" "<<e.x<<" "<<q[ans_posa].x.y<<'\n';
			cout<<0<<" "<<e.x<<" "<<e.y;
		} else {	
			cout<<ans<<'\n';
			cout<<4<<'\n';
			if(abs(q[ans_posa].x.x-s.x)<=abs(q[ans_posa].x.y-s.y))cout<<0<<" "<<q[ans_posa].x.x<<" "<<s.y<<'\n';
			else cout<<0<<" "<<s.x<<" "<<q[ans_posa].x.y<<'\n';
			cout<<1<<" "<<q[ans_posb].x.x<<" "<<q[ans_posa].x.y<<'\n';
			if(abs(q[ans_posa].x.x-e.x)<=abs(q[ans_posa].x.y-e.y))cout<<1<<" "<<q[ans_posa].x.x<<" "<<e.y<<'\n';
			else cout<<1<<" "<<e.x<<" "<<q[ans_posa].x.y<<'\n';
			cout<<0<<" "<<e.x<<" "<<e.y;
		}
	}
	return 0;
}

/*


*/


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 8376kb

input:

1 2
1 1
5 3
6 2

output:

4
3
0 1 2
1 6 3
0 5 3

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 8384kb

input:

2 1
1 1
6 1
1 3
6 3

output:

2
4
0 1 1
1 6 3
1 6 3
0 6 1

result:

wrong answer claimed 2.0000000000, actual 4.0000000000