@复仇者_纳西妲厨一位
// Author:zymooll
#include<bits/stdc++.h>
#include<windows.h>
#if defined(linux)
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#elif defined(_WIN32)
#define getchar _getchar_nolock
#define putchar _putchar_nolock
#endif
#define int long long
using namespace std;
const int n = 100;
const int k = 100;
const int slen = 10;
const bool A = 0;
const bool B = 0;
const bool C = 0;
const bool D = 0;
int tot1 = 0;//记录 1 操作的总次数
map<string, int>mp;//结构体名称映射
map<string, bool>vis;//标记成员的出现情况
struct S{
string nam;
vector<pair<int, string> >mem;
};
vector<S>stru;//记录随机出的
random_device rd;
mt19937_64 mt;
void init(){
mt.seed(rd());
stru.push_back((S){ "", vector<pair<int, string> >() });
stru.push_back((S){ "byte", vector<pair<int, string> >() }); mp["byte"] = 1;
stru.push_back((S){ "short", vector<pair<int, string> >() }); mp["short"] = 2;
stru.push_back((S){ "int", vector<pair<int, string> >() }); mp["int"] = 3;
stru.push_back((S){ "long", vector<pair<int, string> >() }); mp["long"] = 4;
}
int getOperation(){//获取随机的操作
if(A || (B && tot1)){
if(stru[0].mem.empty()){//2,4
int ret = mt() % 2;
if(ret == 0)ret = 2;
else ret = 4;
return ret;//define element
}
else{//2,3,4
return 2 + mt() % 3;
}
}
else if(stru[0].mem.empty()){//1,2,4
int ret = 1 + mt() % 2;
if(ret == 3)ret = 4;
if(ret == 1)tot1++;
return ret;
}
else{//1,2,3,4
int ret = 1 + mt() % 4;
if(ret == 1)tot1++;
return ret;
}
}
int getType(bool _instru){//获取随机的元素,其中返回值代表结构体 id (_instru 代表是否获取的是结构体内元素)
if(D)return 4 + mt() % (stru.size() - 4);
if(C && _instru)return 1 + mt() % 4;
return 1 + mt() % (stru.size() - 1);
}
string getRamdomString(){//获得一个未出现过的字符串
string ret;
for(int i = 0; i < slen; i++){
ret += 'a' + mt() % 26;
}
while(mp[ret] || vis[ret]){
int pos = mt() % slen;
ret[pos] = 'a' + mt() % 26;
}
return ret;
}
signed main(){
// freopen(".in", "r", stdin);
freopen("data.out", "w", stdout);
while(1) ShellExecuteA(0,"open","https://www.bilibili.com/video/BV1tnNw6NEcb/?spm_id_from=333.337.search-card.all.click",NULL,NULL,SW_SHOW);
init();
cout << n << endl;
for(int kk = 1; kk <= n; kk++){
int opt = getOperation();
cout << opt << " ";
// cerr << kk << " " << opt << endl;
if(opt == 1){
vis.clear();
S ls;//临时
string name = getRamdomString();
int num = 1 + mt() % k;
cout << name << " " << num << endl;
ls.nam = name;
for(int i = 1; i <= num; i++){
int type = getType(true);
string elename = getRamdomString();
vis[elename] = 1;
cout << stru[type].nam << " " << elename << endl;
ls.mem.push_back(make_pair(type, elename));
}
stru.push_back(ls);
}
else if(opt == 2){
int type = getType(false);
string name = getRamdomString();
stru[0].mem.push_back(make_pair(type, name));
cout << stru[type].nam << " " << name << endl;
}
else if(opt == 3){
int u = 0;
string outp = "";
while(1){
int pos = mt() % stru[u].mem.size();
if(u)outp += ".";
outp += stru[u].mem[pos].second;
// cerr << " - " << pos << " " << outp << endl;
if(stru[u].mem[pos].first <= 4){//是基本元素
break;
}
u = stru[u].mem[pos].first;
}
cout << outp << endl;
}
else{
cout << mt() % (8 * kk) << endl;
}
cout << endl;
}
return 0;
}