造福后人
查看原帖
造福后人
1201196
Zhenghw楼主2024/10/27 21:40

由于本题过于毒瘤,因此感觉非常有必要放一下本题的数据生成器和checker(当然都是自己写的)

数据生成器:

#include<random>
#include<iostream>
using namespace std;
random_device seed;
mt19937 rnd(seed());
const int mod=1e6+1;
const int N=1e5,M=2e4;
inline int randp(){
	return int(rnd())%mod;
}int main(){
	cin.tie(0),cout.tie(0);
	ios::sync_with_stdio(false);
	freopen("P3517.in","w",stdout);
	cout<<N<<' '<<M<<'\n';
	for(int i=N;i;i--)
		cout<<randp()<<' '<<randp()<<'\n';
	return 0;
}

checker:

#include<cmath>
#include<iostream>
using namespace std;
const int N=1e5+5;
const double eps=5e-7;
int i,j,n,m;
double r,ox,oy;
double x[N],y[N];
inline double d(double x1,double y1,double x2,double y2){
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}int main(){
	cin.tie(0),cout.tie(0);
	ios::sync_with_stdio(false);
	freopen("P3517.in","r",stdin); //输入文件
	cin>>n>>m;
	for(i=1;i<=n;i++)
		cin>>x[i]>>y[i];
	fclose(stdin);
	freopen("P3517.out","r",stdin); //输出文件
	cin>>r>>m,r+=eps;
	for(i=j=1;i<=m;i++){
		cin>>ox>>oy;
		while(j<=n&&d(ox,oy,x[j],y[j])<=r)
			j++;
	}if(j<=n){
		cout<<"Wrong Answer!\n";
		cout<<"The "<<j<<"th point ("<<x[j]<<','<<y[j]<<") is not contained!";
	}else cout<<"Accepted!";
	return 0;
}

至于checker的用法,先用写好的程序将答案输出到out文件中,然后运行checker即可检测答案正确性。

如果答案错误,它会告诉你你的答案中第一个没有被包含在圆内的点是第几个点。

需要注意的是这个checker只用于检查所有点是否都被包含,无法用于检测半径是否最小,因此如果能够通过这个checker检验的答案不一定正确

但无法通过检验的答案一定不正确。

2024/10/27 21:40
加载中...