跳到正文

个人记录

神秘脚本 + 神秘颜色

ケロシ约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟

版本

  1. v1当前
Python
import os
import time

problem = "sequence"
grader_name = "grader"

def compile_cpp():
	os.system(f"g++ -std=gnu++17 -O2 -Wall -pipe -static -o {problem} {grader_name}.cpp {problem}.cpp")

def run_cpp():
	os.system(f"./{problem}")

tests = [
	'sample-1',
	'sample-2',
	'sample-3',
]

compile_cpp()

print("compile finish")

for test in tests:
	os.system(f"cp {test}.in 0.in")
	print(f"run test {test}")
	p1 = time.time()
	run_cpp()
	p2 = time.time()
	o = os.system(f"diff 0.out {test}.out -w")
	if o:
		print("\033[91m" + "WA %.5f" % (p2 - p1) + "\033[0m")
	else:
		print("\033[92m" + "OK %.5f" % (p2 - p1) + "\033[0m")

#22B866 #069A4F

原文