造福后人
  • 板块P9518 queue
  • 楼主hepp
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/10/4 10:45
  • 上次更新2024/10/4 13:20:12
查看原帖
造福后人
541313
hepp楼主2024/10/4 10:45

数据随机生成器

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+10;
inline int read()
{
	int x=0;char ch=getchar();bool fg=0;
	while(ch<'0'||ch>'9'){if(ch=='-')fg=1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch-'0');ch=getchar();}
	return (fg?(~(x-1)):x);
}
int a[N];
signed main()
{
	freopen("1.in","w",stdout);
	int n=read();srand(n);printf("%lld\n",n);
	for(int i=1;i<=n;i++){
		int op=rand()%3;
		if(op==0){
			printf("start\n");
		}
		else if(op==1){
			int op2=rand()%2;
			if(!op2||!a[0])
			{
				a[++a[0]]=rand();
				printf("arrive %lld\n",a[a[0]]);
			}
			else{
				int c=rand()%a[0]+1;
				printf("arrive %lld\n",a[c]);
			}
		}
		else if(op==2){
			int op2=rand()%2;
			if(!op2||!a[0])
			{
				int c=rand();
				printf("leave %lld\n",c);
			}
			else{
				int c=rand()%a[0]+1;
				printf("leave %lld\n",a[c]);
			}
		}
	}
	return 0;
}
2024/10/4 10:45
加载中...