From 99e2e923d0c77b02f3fb4ff648ea916954868606 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 28 Feb 2025 23:13:39 +0800 Subject: chore(store): move everything to store. --- store/works/life/algorithm-contest-2/gen.ps1 | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 store/works/life/algorithm-contest-2/gen.ps1 (limited to 'store/works/life/algorithm-contest-2/gen.ps1') diff --git a/store/works/life/algorithm-contest-2/gen.ps1 b/store/works/life/algorithm-contest-2/gen.ps1 new file mode 100644 index 0000000..60b88b2 --- /dev/null +++ b/store/works/life/algorithm-contest-2/gen.ps1 @@ -0,0 +1,39 @@ +Push-Location solution + +foreach ($problem in 1..5) { + clang-cl "$problem.cpp" /O2 "-fsanitize=address,undefined" +} + +Pop-Location + +Remove-Item -Recurse output + +mkdir .\output + +$time_output = @() + +foreach ($problem in 1..5) { + mkdir output/$problem + foreach ($genfile in Get-ChildItem "generator/$problem") { + if ($genfile.Name -match "(.+)\.in") { + $genfile_id = $Matches[1] + Copy-Item $genfile output/$problem + } + elseif ($genfile.Name -match "(.+)\.cpp") { + $genfile_id = $Matches[1] + Push-Location "generator/$problem" + clang-cl $genfile.Name /O2 "-fsanitize=address,undefined" + Pop-Location + & "./generator/$problem/$genfile_id.exe" > "./output/$problem/$genfile_id.in" + } + $time = (Measure-Command { + Get-Content "./output/$problem/$genfile_id.in" | & "./solution/$problem.exe" > "./output/$problem/$genfile_id.out" + }).TotalSeconds + + $time_output += "Problem $problem test point $genfile_id time: $time s." + } +} + +foreach ($line in $time_output) { + Write-Output $line +} -- cgit v1.2.3