提供一份数据生成器(对拍使用
查看原帖
提供一份数据生成器(对拍使用
979266
Genius_Star楼主2024/6/22 10:34

Code:

#include<bits/stdc++.h>
#define Add(x,y) (x+y>=mod)?(x+y-mod):(x+y)
#define lowbit(x) x&(-x)
#define full(l,r,x) for(auto it=l;it!=r;it++) (*it)=x
#define Full(a) memset(a,0,sizeof(a))
#define open(s1,s2) freopen(s1,"r",stdin),freopen(s2,"w",stdout);
using namespace std;
typedef double db;
typedef long long ll;
const ll N=100,M=5,W=10,Q=100;
// N 为节点数量的限制
// M 为边数超越节点数的数量的限制
// W 是边权的大小限制
// Q 是询问的次数限制
mt19937 R(time(0));
inline ll read(){
    ll x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')
          f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<1)+(x<<3)+(c^48);
        c=getchar();
    }
    return x*f;
}
inline void write(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	if(x>9)
	  write(x/10);
	putchar(x%10+'0');
}
struct Node{
	ll u,key;
	bool operator<(const Node&rhs)const{
		return key<rhs.key;
	}
};
ll n,m,q;
priority_queue<Node> p;
int main(){
	n=R()%(N-2)+3,m=n+R()%M;
	write(n);
	putchar(' ');
	write(m);
	putchar('\n');
	for(int i=1;i<=n;i++)
	  p.push({i,R()});
	for(int u,v,i=1;i<n;i++){
		u=p.top().u;
		p.pop();
		v=p.top().u;
		p.pop();
		if(R()&1ll)
		  p.push({u,R()});
		else
		  p.push({v,R()});
		write(u);
		putchar(' ');
		write(v);
		putchar(' ');
		write(R()%W+1);
		putchar('\n'); 
	}
	m-=n-1;
	while(m--){
		ll u,v;
		while(1){
			u=R()%n+1,v=R()%n+1;
			if(u==v)
			  continue;
			break;
		}
		write(u);
		putchar(' ');
		write(v);
		putchar(' ');
		write(R()%W+1);
		putchar('\n'); 		
	}
	q=R()%Q+1;
	write(q);
	putchar('\n');
	while(q--){
		ll u,v;
		while(1){
			u=R()%n+1,v=R()%n+1;
			if(u==v)
			  continue;
			break;
		}
		write(u);
		putchar(' ');
		write(v);
		putchar('\n');		
	} 
	return 0;
}
2024/6/22 10:34
加载中...