Cyaron模板
推荐一款不错的数据生成器:CYaRon,一个基于Python的测试数据生成库。能够生成一部分信息竞赛中需要的数据,操作简单,易入门。
部署及基本语法
详见 luogu 官方文档。
常用模板
-
数据生成
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17from cyaron import *
_n = ati([1, 7, 50, 1E4])
_m = ati([1, 11, 100, 1E4])
for i in range(1, 4):
io = IO(file_prefix = "name", data_id = i)
n = _n[i]
m = _m[i]
s = randint(1, n)
t = randint(1, n)
graph = Graph.graph(n, m, weight_limit = 5)
io.input_writeln(n, m, s, t)
io.input_writeln(graph)
io.output_gen("std") -
对拍
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19from cyaron import *
for i in range(1000):
print("Case:{0}".format(i))
iostd = IO("name.in", "name.stdout")
iotest = IO("name.in", "name.testout")
n = randint(1, 3)
m = randint(n - 1, 5)
s = randint(1, n)
t = randint(1, n)
graph = Graph.UDAG(n, m, weight_limit = 10)
iostd.input_writeln(n, m, s, t)
iostd.input_writeln(graph.to_str(shuffle = True))
iostd.output_gen("./std")
iotest.output_gen("./test")
Compare.output("name.testout", std = "name.stdout")
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 燃烧的冰块_husky's blog!
评论









