Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LemonLime (Python)

基于 Python 与 tkinter 的 OI 比赛评测器(LemonLime 的 Python 实现)。

功能

  • 从目录结构加载比赛:data/<题目>/*.in + *.ans 测试数据,source/<选手>/<题目>/<题目>.cpp 选手源码
  • 编译(g++,默认 -O2 -std=c++14)并运行选手程序,限制 CPU 时间 / 内存 / 输出大小
  • 宽松比对输出(忽略行尾空白与末尾空行),与 LemonLime 默认 diff 行为一致
  • 后台线程判题、实时进度、可中途停止
  • 排名榜(排名 / 总分 / 每题得分)+ 选手每题逐测试点详情(状态 / 得分 / 用时 / 内存)
  • 导出结果:JSON(类 noip.cdf)与 HTML 排名榜(类 result.html)

使用方法

图形界面:

python3 -m lemonlime --gui

终端界面(TUI,curses):

python3 -m lemonlime --tui [contest_dir]

TUI 按键:

按键 功能
/ k / j 排名表中移动选择
Enter 评测选中的选手
J 评测所有选手
s 停止判题
e 导出 JSON 结果
q 退出

命令行判题:

python3 -m lemonlime /path/to/contest            # 判完整场比赛
python3 -m lemonlime /path/to/contest -p candy   # 只判 candy 题
python3 -m lemonlime /path/to/contest -c CQ-0001 # 只判某位选手
python3 -m lemonlime /path/to/contest -o out.json --html rank.html

比赛目录布局:

contest/
  data/candy/candy1.in  candy1.ans ...   # 题目测试数据
  source/CQ-0001/candy/candy.cpp ...     # 选手源码

状态码

状态 含义
0 AC 正确
1 WA 答案错误
2 TLE 超时
3 MLE 内存超限
4 RE 运行错误
5 OLE 输出超限
6 CE 编译错误

模块结构

模块 说明
model.py 数据模型:Contest / Problem / TestPoint / Contestant / Submission
judger.py 评测核心:编译、资源限制、运行、输出比对
loader.py 从目录加载比赛
exporter.py 导出 JSON / HTML 结果
gui.py tkinter 图形界面
__main__.py 命令行入口

Windows 支持

平台自动检测(judger.py 中的 IS_WINDOWS):

  • 判题:Windows 下使用 subprocess + Job Object(ctypes,仅标准库)限制 CPU 时间与内存,无需 fork/setrlimit;需要 PATH 中有 g++(如 MinGW-w64)
  • TUI:Windows 标准库没有 curses,需先 pip install windows-curses;未安装时 --tui 会提示安装
  • GUI:tkinter 随 Windows 官方 Python 安装包自带,直接可用
  • 命令行彩色输出:自动启用 Windows 10+ 控制台的 ANSI 转义

已知限制

  • 未实现子任务(subtask)分组计分与 Special Judge。

About

OI contest judge in Python — LemonLime reimagined with tkinter GUI, curses TUI and CLI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages