社区讨论

赠送数据生成器

P7735[NOI2021] 轻重边参与者 1已保存回复 0

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
0 条
当前快照
1 份
快照标识符
@ltprc1n3
此快照首次捕获于
2024/03/13 20:08
2 年前
此快照最后确认于
2024/03/13 21:30
2 年前
查看原帖
CPP
#include<iostream>
#include<time.h>
using namespace std;
int main()
{
    freopen("data.in","w",stdout);
    srand(time(0));
    cout<<3<<endl;
    for(int i=1;i<=3;i++)
    {
        int n=rand()%20+1;
        int m=rand()%40+1;
        cout<<n<<" "<<m<<endl;
        for(int j=2;j<=n;j++)
            cout<<j<<" "<<rand()%(j-1)+1<<endl;
        for(int j=1;j<=m;j++)
        {
            int op;
            op=rand()%2+1;
            if(op==1)
            {
                int u=rand()%n+1;
                int v=rand()%n+1;
                if(u==v)
                    v=(v+1)%n+1;
                cout<<op<<" "<<u<<" "<<v<<endl;
            }
            else
            {   
                int u=rand()%n+1;
                int v=rand()%n+1;
                if(u==v)
                    v=(v+1)%n+1;
                cout<<op<<" "<<u<<" "<<v<<endl;
            }
        }
    }
}

回复

0 条回复,欢迎继续交流。

正在加载回复...