fork download
#include <iostream>
#include <random>
#include <string>
#include <vector>
#include <cstdint>
#include <chrono>
#include <algorithm>

typedef std::vector<std::string> SVec;

SVec MakeSVec(std::size_t V, std::size_t H) {
	std::string Sfen = "KRBGANLPkrbgsnlp123456789wb+- ";//字数あってるかな??

	std::random_device rd;
	//std::mt19937 mt(rd());//if you need perfect random to delte comment out in top of this line. 
	std::mt19937 mt(0);
	std::uniform_int_distribution<std::size_t> SF(0, Sfen.size()-1);//sfen表現の予定
	std::uniform_int_distribution<std::size_t> BF(H-32, H+32);//盤面表現の予定
	std::uniform_int_distribution<> PV(-1000000, 1000000);//数字は適当。
	std::uniform_int_distribution<std::size_t> PN(16, 256);//パラメータ数の予定
	
	std::string S;
	SVec R(V);

	std::size_t SN = 0;

	for (auto& o : R) {
		S.clear();
		SN = BF(mt);
		S += "'";
		for (std::size_t i = 0; i < SN; i++) {
			S += Sfen[SF(mt)];
		}
		S += "'";
		SN = PN(mt);
		for (std::size_t i = 0; i < SN; i++) {
			S += ',' + std::to_string(PV(mt));
		}
		o = S;
	}

	std::sort(S.begin(), S.end());

	return R;

}

bool Shuffle(SVec& S) {
	std::random_device rd;
	std::mt19937 mt(rd());//if you need perfect random to delte comment out in top of this line. 
	//std::mt19937 mt(0);

	std::shuffle(S.begin(), S.end(),mt);

	return true;
}

int main() {
	std::size_t H = 1000000;
	std::size_t V = 80;
	SVec R;

	std::cout << "start data generation.";
	auto S = std::chrono::high_resolution_clock::now();

	R = MakeSVec(H, V);

	auto E = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - S);

	std::cout << "..Done. time:"<<E.count()<<"ms."<<std::endl;

	std::cout << "start data Shuffle.";
	S = std::chrono::high_resolution_clock::now();
	Shuffle(R);
	E = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - S);
	std::cout << "..Done. time:"<<E.count()<<"ms."<<std::endl;

	std::cout << "Thank you!" << std::endl;
	return 0;
}
Time limit exceeded #stdin #stdout 5s 105216KB
stdin
Standard input is empty
stdout
Standard output is empty