QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#175004#7184. Transport Plusesucup-team956#WA 2ms4000kbC++201.8kb2023-09-10 15:30:562023-09-10 15:30:57

Judging History

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

  • [2023-09-10 15:30:57]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:4000kb
  • [2023-09-10 15:30:56]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define time chrono::system_clock::now().time_since_epoch().count()
mt19937_64 rnd(time);
#define maxn 1000005
#define int long long

int read() {int x;cin>>x;return x;}

struct node {
	int x, y;
};

signed main()
{
	// ios::sync_with_stdio(false);
	// cin.tie(0);
	// cout.tie(0);
	auto dis = [&](node a, node b) {
		return sqrt((a.x - b.x)*(a.x - b.x) + (a.y - b.y) * (a.y - b.y));
	};
	auto cal = [&](node a, node b) {
		return min(abs(a.x - b.x), abs(a.y - b.y));
	};
	int n = read(), t = read();
	int xs = read(), ys = read();
	int xe = read(), ye = read();
	node ps = {xs, ys};
	node pe = {xe, ye};
	vector<node>p(n);
	for(int i = 0; i < n; i++) {
		int x = read(), y = read();
		p[i] = {x, y};
	}
	vector<tuple<int,int,int>>ans;
	ans.push_back({0, xe, ye});
	double res = dis(ps, pe);
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			int t1;
			if(i == j) t1 = t;
			else t1 = 2 * t;
			int aa = cal(ps, p[i]) + cal(p[j], pe) + t1;
			if(aa < res) {
				res = aa;
				int tox, toy;
				if(abs(ps.x - p[i].x) < abs(ps.y - p[i].y)) {
					tox = p[i].x;
					toy = ps.y;
				}
				else{
					tox = ps.x;
					toy = p[i].y;
				}
				ans.clear();

				if(tox != xs || toy != ys) ans.push_back({0, tox, toy});
				if(i != j) {ans.push_back({i, p[i].x, p[j].y});}
				if(abs(pe.x - p[j].x) < abs(pe.y - p[j].y)) {
					tox = p[j].x;
					toy = pe.y;
				}
				else{
					tox = pe.x;
					toy = p[j].y;
				}
				ans.push_back({j, tox, toy});
				if(tox != xe || toy != ye) {
					ans.push_back({0, xe, ye});
				}
			}
		}
	}
	printf("%.15lf\n",res);
	cout << ans.size() << "\n";
	for(auto [id, x, y]:ans) {
		cout << id << " " << x << " " << y <<"\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 4000kb

input:

1 2
1 1
5 3
6 2

output:

4.000000000000000
3
0 1 2
0 5 2
0 5 3

result:

wrong answer claimed 4.0000000000, actual 6.0000000000