提供一份简易的数据生成代码
查看原帖
提供一份简易的数据生成代码
1015805
xiao__xiao楼主2023/12/28 19:34
#include<bits/stdc++.h> 
#define ll long long 

using namespace std;

const int p = 1e9 ,pp = 4e5;

map<pair<int,int>,bool> vis ;

int random(int n){
	return 1ll * rand() * rand() % n ;
}

int main(){
	ios::sync_with_stdio(false);
	srand((unsigned)time(0));
	int n = random(p) + 1 ,m = random(p) + 1; 
	int k = min(100ll,1ll * n * m - 1) ;
	
	cout << n << ' ' << m << ' ' << k << endl;
	for(int i = 1 ,x ,y;i <= k;i ++ ){
		x = random(n) + 1,y = random(m) + 1;
		while(vis[{x,y}]){
			x = random(n) ,y = random(m) ;
		}
		vis[{x,y}] = true ;
		cout << x << ' ' << y << endl;
	}
	
	return 0;
}
2023/12/28 19:34
加载中...