彩虹糖题解
2026-09-02 19:44:56
发布于:浙江
5阅读
0回复
0点赞
#include<bits/stdc++.h>
#include<chrono>
using namespace std;
int main()
{
// 双熵源:纳秒时间戳 + 当前栈变量地址(每个进程地址不一样)
uint64_t t = chronohigh_resolution_clocknow().time_since_epoch().count();
char dummy;
uint64_t addr = reinterpret_cast<uint64_t>(&dummy);
uint64_t seed = t ^ (addr << 17);
mt19937_64 rng(seed);
uniform_int_distribution<> dis(0,8);
int op = dis(rng);
int a,b;
cin >> a >> b;
if(op == 0){
// ✅ AC
cout << a + b << '\n';
}else if(op == 1){
// 🟪 WA
cout << 114514 << '\n';
}else if(op == 2){
// 🟥 RE 数组越界
int arr[8];
cout << arr[0xffffff] << endl;
}else if(op == 3){
// 🟥 RE 除零
int z=0;
cout << a / z << endl;
}else if(op == 4){
// 🟥 RE 无限递归爆栈
function<void()> f = [&](){f();};
f();
}else if(op == 5){
// 🟨 TLE
for(;;){}
}else if(op == 6){
// 🟩 MLE
vector<int>v;
while(true) v.insert(v.end(), 500000, 1);
}else if(op == 7){
// 🟦 OLE
while(true) cout<<"rainbow";
}else if(op == 8){
// 🟫 PE
cout << a+b << " \n\n\n\n";
}
return 0;
}
彩虹糖
这里空空如也







有帮助,赞一个