造福后人
  • 板块灌水区
  • 楼主_WRYYY_
  • 当前回复9
  • 已保存回复10
  • 发布时间2023/10/23 20:00
  • 上次更新2023/11/2 11:40:50
查看原帖
造福后人
333709
_WRYYY_楼主2023/10/23 20:00

提供一个 CSP-S T3 数据生成器(on linux,windows 应该也可以用)

数据足够阴间,可以手模

#include <bits/stdc++.h>
#include <bits/extc++.h>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define N 300010
using namespace std;
using namespace __gnu_pbds;
mt19937 rnd(time(0));
map<string, bool> hs, hs1;
vector<string> cl, xn;
map<string, string> xc;
map<string, vector<pair<string, string>>> cc;
int main()
{
	// freopen("data.in", "r", stdin);
	freopen("data.in", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n = 10, opt, len, k, alen, pl;
	string s, s1;
	cl.push_back("int");
	cl.push_back("long");
	cl.push_back("byte");
	cl.push_back("short");
	cout << n << "\n";
	vector<pair<string, string>> vc;
	while (n--)
	{
		opt = rnd() % 4 + 1;
		if (opt == 1)
		{
			cout << opt << " ";
			len = rnd() % 5 + 1;
			do
			{
				s1.clear();
				for (int i = 0; i < len; i++)
				{
					s1.push_back(rnd() % 26 + 'a');
				}
			} while (hs.count(s1));
			vc.clear();
			k = rnd() % 5 + 1;
			cout << s1 << " " << k << "\n";
			alen = cl.size();
			hs1.clear();
			for (int i = 1; i <= k; i++)
			{
				len = rnd() % 5 + 1;
				vc.push_back(mp(cl[rnd() % alen], "0"));
				cout << vc.back().first << " ";
				do
				{
					s.clear();
					for (int i = 0; i < len; i++)
					{
						s.push_back(rnd() % 26 + 'a');
					}
				} while (hs1.count(s));
				cout << s << "\n";
				vc[vc.size() - 1].second = s;
			}
			cc[s1] = vc;
			cl.push_back(s1);
			hs[s1] = 1;
		}
		else if (opt == 2)
		{
			cout << opt << " ";
			alen = cl.size();
			s1 = cl[rnd() % alen];
			cout << s1 << " ";
			len = rnd() % 5 + 1;
			do
			{
				s.clear();
				for (int i = 0; i < len; i++)
				{
					s.push_back(rnd() % 26 + 'a');
				}
			} while (hs.count(s));
			hs[s] = 1;
			xn.push_back(s);
			xc[s] = s1;
			cout << s << "\n";
		}
		else if (opt == 3)
		{
			if (xn.empty())
			{
				++n;
				continue;
			}
			cout << opt << " ";
			alen = xn.size();
			s1 = xn[rnd() % alen];
			s = xc[s1];
			cout << s1;
			while (s != "int" && s != "long" && s != "short" && s != "byte")
			{
				vc = cc[s];
				alen = vc.size();
				pl = rnd() % alen;
				s = vc[pl].first;
				cout << "." << vc[pl].second;
			}
			cout << "\n";
		}
		else
		{
			cout << opt << " ";
			cout << rnd() % 40 << "\n";
		}
	}
	return 0;
}
2023/10/23 20:00
加载中...