cyaron
cyaron copied to clipboard
CYaRon: Yet Another Random Olympic-iNformatics test data generator
如何生成无权图?
如题,听说可以用weight_gen,可具体该怎么用?
See: https://github.com/luogu-dev/cyaron/issues/109
我写了一个这样的数据生成器: ```python from cyaron import * test_data = IO(file_prefix="small", data_id=1) n = randint(1, 4000) test_data.input_writeln(n) a = Vector.random(n, [(0, 1000)]) test_data.input_writeln(a) b = Vector.random(n, [(0, 1000)]) test_data.input_writeln(b) k = randint(1,...
如题,并未发现 cyaron 有类似功能。下文为一种可能的实现,原理为随机删除树边,同时因 Python del O(n),因此采取了看上去比较丑的写法,但复杂度是 O(n) 的。 ``` @staticmethod def forest(point_count, chain=0, flower=0, **kwargs): """forest(point_count, chain=0, flower=0, **kwargs) -> Graph Factory method. Return a forest with point_count vertexes. int...

有些题目,输出中含有中文,生成文件,上传到OJ时,会无法显示
希望加一些与生成二维矩阵图相关的函数,比如下面这种: ...S.. ....# ###.. T....
rt, 希望加入此功能
因为是用图存储二叉树,所以是不是没办法确定子结点是左还是右?
有根树使用 Graph.to_str() 时,如果使用 shuffle=True 参数,会导致根结点被 shuffle 到其它位置,这一操作对于有根树显然是没有任何意义的。为了避开 cyaron 的 shuffle 操作而手写 shuffle 的繁琐程度已经超过了直接用 Cpp 手搓数据。我建议参数应当允许仅 shuffle 点或仅 shuffle 边(或者支持不 shuffle 根节点的功能)。