我不确定是否可以寻求帮助(如果没有,我不介意在比赛结束之前不会得到答案)。
我正在用CodeJam解决交互式问题(Dat Bae)。在本地文件上,我可以分别运行评委(testing_tool.py
)和程序(<name>.py
),然后手动复制并粘贴I / O。但是,我认为我需要找到一种自动实现它的方法。
编辑:为了清楚起见,我希望将x文件的每个输出都输入到y文件中,反之亦然。
一些细节:
我在整个程序中都使用sys.stdout.write
/ sys.stdin.readline
代替了打印/输入
我尝试运行interactive_runner.py
,但是我似乎不知道如何使用它。
我尝试在其服务器上运行它,我的程序在第一个选项卡中,第二个判断文件。它总是抛出TLE错误。
我似乎也没有找到可以完成相同操作的教程,我们将不胜感激! :/
答案 0 :(得分:3)
用法记录在脚本内的注释中:
interactive_runner.py
# Run this as:
# python interactive_runner.py <cmd_line_judge> -- <cmd_line_solution>
#
# For example:
# python interactive_runner.py python judge.py 0 -- ./my_binary
#
# This will run the first test set of a python judge called "judge.py" that
# receives the test set number (starting from 0) via command line parameter
# with a solution compiled into a binary called "my_binary".
testing_tool.py
# Usage: `testing_tool.py test_number`, where the argument test_number
# is 0 for Test Set 1 or 1 for Test Set 2.
所以像这样使用它们:
python interactive_runner.py python testing_tool.py 0 -- ./dat_bae.py