警示后人
查看原帖
警示后人
1377813
Luo_Saisei楼主2025/2/3 22:54

如果你WAsub#1

你可能把cmp写成

pair<long double, int> cmx(pair<long double, int> a, pair<long double, int> b)
{
	if (a.first - b.first > eps)
	{
		return a;
	}
	else if (a.first - b.first < eps)
	{
		return b;
	}
	else
	{
		return a.second < b.second ? a : b; // 取编号最小
	}
}

实际上应该是

pair<long double, int> cmx(pair<long double, int> a, pair<long double, int> b)
{
	if (a.first - b.first > eps)
	{
		return a;
	}
	else if (b.first - a.first > eps)
	{
		return b;
	}
	else
	{
		return a.second < b.second ? a : b; // 取编号最小
	}
}
2025/2/3 22:54
加载中...