附赠数据生成器
查看原帖
附赠数据生成器
912241
return_TLE楼主2024/9/12 22:50
#include <bits/stdc++.h>
using namespace std;
int main()
{
	srand(clock()^time(0));
	int n=rand()%5+5,m=rand()%5+5;
	freopen("data.out","w",stdout);
	cout<<n<<" "<<m<<"\n";
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
			cout<<(int)(rand()%10*1e8)+rand()%10000*10000+rand()<<" ";
		cout<<"\n";
	}
	for(int i=1;i<=n;i++)
	{
		int a[16]={0};
		int k=rand()%n+1;
		for(int j=1;j<=k;j++)
			a[rand()%(n-1)+1]=1;
		int cnt=0;
		for(int j=1;j<=n;j++)
			if(a[j]==1)
				cnt++;
		cout<<cnt<<" ";
		for(int j=1;j<=n;j++)
			if(a[j]==1)
				cout<<j<<" ";
		cout<<"\n";
	}
	return 0;
}
2024/9/12 22:50
加载中...