中文 | English
A tool that generates the event-feed file for the ICPC resolver via the DOMjudge RESTful API.
One command produces resolver-ready scoreboard data with award information attached.
Awards generated by default:
- Overall first place (World Champion)
- Top three official teams
- Gold medal teams
- Silver medal teams
- Bronze medal teams
- Best women's team award
- First-to-solve award for official teams
- Tenacious Award (last accepted submission)
First WA award
Star (unofficial) teams still receive gold, silver, or bronze medals, but they do not consume any of the official medal slots.
Alongside the json output, a csv file with the same name is generated. It contains the team information and awards, which makes it convenient to build the award-ceremony slides.
Notes on reading the resolver source code (in Chinese): 滚榜程序Resolver源码阅读
Recommended: icpc-resolver-2.6.1331
Python dependencies are listed in requirements.txt:
pip install -r requirements.txt- Set up
config.json
{
"url": <contest api url>,
"file": <local event feed, optional>,
"username": <username whose role is api_reader>,
"password": <password of the user>,
"skip_verify": true/false,
"cache_requests": true/false,
"download_logos": true/false,
"json": <output json file name>,
"gold": <the number of gold medals>,
"silver": <the number of silver medals>,
"bronze": <the number of bronze medals>,
"first_place_citation": <citation of first place award>,
"gold_show_list": true/false,
"silver_show_list": true/false,
"bronze_show_list": true/false,
"honors_show_list": true/false,
"no_occupy_award_categories": [<group_id1>, <group_id2>, ...],
"award_best_girl": [<group_id1>],
"exclude_teams": [<team_id1>, <team_id2>, ...],
"manual_medals": {"gold": [<team_id>], "silver": [<team_id>], "bronze": [<team_id>]},
"special_awards": [
{"id": <award id>, "rule": "last_ac" | "most_submissions", "citation": <citation>},
{"id": <award id>, "citation": <citation>, "team_ids": [<team_id1>, ...]}
]
}-
The
userused to log in must have theapi_readerrole. -
fileis a local event feed (NDJSON). When it is not empty the data is rebuilt from that file instead of the API, and no logos are downloaded./scoreboardis not part of an event feed, so it is recomputed from the submissions using the contest penalty rules. -
skip_verifycontrols whether HTTPS certificate verification is skipped. The recommended default isfalse. Only set it totruewhen the contest server's certificate is unusable and you trust the network you are on. -
cache_requestscontrols whether the raw DOMjudge API responses are cached. Whentrue, the tool first looks for a local copy inapi-cache/. Only when no matching file exists does it hit the network, after which the response is stored in that directory. -
download_logoscontrols whether affiliation/organization logos are downloaded. Whentrue, the tool requests/organizations/{id}/logoand saves each logo toorganizations/<organization_id>/logo.png. -
first_place_citationis the citation shown in the event feed for the overall first-place award.World Championis a sensible default. -
gold_show_list,silver_show_list,bronze_show_list, andhonors_show_listcontrol whether the resolver additionally shows the teams in that tier as a list (Gold Winner,Silver Winner,Bronze Winner,Honorable Mention). -
no_occupy_award_categorieslists the group IDs of star teams. Star teams that land in the medal zone still get their photo shown (they are given theStar Teamaward), but they do not take up any official medal slot. -
award_best_girllists the group ID used for the best women's team award. The highest-ranked team in that group receives the award. -
manual_medalsnames the medal winners directly. When any of its lists is non-empty the medals are no longer derived from the ranking, the 1st/2nd/3rd Place awards follow the same teams, and everyone else falls intoHonorable Mention. -
special_awardsis a list of extra prizes. Each entry has anidand acitation, and is either computed by aruleor hand-picked withteam_ids:"rule": "last_ac": the last team to make a first accepted submission on a problem."rule": "most_submissions": the team(s) with the most judged submissions."team_ids": [...]: the listed teams receive the award as-is (e.g. a sponsor prize).
Star teams never receive rule-based special awards. If
special_awardsis omitted, a single last-AC award is produced with the citation fromlast_ac_citation(defaultTenacious Award). -
exclude_teamslists the team IDs to drop from the resolution. Those teams, their submissions and their judgements are left out of the generatedevent-feedentirely. -
Star teams are not eligible for the first-to-solve award.
"url": "https://www.example.com/api/v4/contests/{cid}",
"username": "cds",
"password": "cds",
"skip_verify": false,
"cache_requests": false,
"download_logos": false,
"json": "event-feed",
"gold": 16,
"silver": 32,
"bronze": 47,
"first_place_citation": "World Champion",
"gold_show_list": false,
"silver_show_list": true,
"bronze_show_list": true,
"honors_show_list": true,
"no_occupy_award_categories": ["18", "20"],
"award_best_girl": ["11"]- Run
main.py
python3 main.py
A different config file can be passed with --config:
python3 main.py --config my-config.json
Place the generated event-feed.json inside a directory laid out in the CDP format, then run the Resolver:
./resolver.sh /path/to/cdpThe CDP directory layout for Resolver 2.5 looks like this:
.
├── contest
│ └── logo.png // image on the resolver's main page & default photo for teams without one
├── event-feed.json // the json generated by this Python tool
├── organizations // Affiliation logos. If any team of an affiliation has a logo, every team of that affiliation uses it
│ ├── 2 // affiliation id
│ │ └── logo.png
└── teams // team photos
├── 3000 // team id
│ └── photo.png
├── 3001
│ └── photo.png
├── 3009
│ └── photo.png
└── 3010
└── photo.pngAdapted to Resolver 2.6.1331.
Added API response caching and affiliation logo downloading.
The Tenacious Award now skips repeated ACs on the same problem.
Adapted to the PTA version.
Updated for DOMjudge >= 8.2. The PTA version has not been tested!
For DOMjudge 7.0, see the domjudge7 branch.
A demo folder in CDP format is provided. Run the resolver with:
./resolver.sh ./demoAdded the PTA_School class for the PTA platform, implementing the CCPC Final award rules. Award names use Chinese plus Emoji, and the font is Noto Sans CJK.
Award rules:
- Gold, silver, and bronze are awarded by school ranking.
- Undergraduate and vocational-college groups are awarded separately.
- A team that is not the top team of its school takes the school rank of the next team below it.
pta.json description:
{
"url": "https://pintia.cn/api/xcpc/problem-sets/<PID>/",
"file":"",
"username": <pta email>,
"password": <pta password>,
"xml": "events",
"ben": {
"group": [1],
"gold": 10,
"silver": 20,
"bronze": 30,
"first": 3,
"suffix": ""
},
"zhuan": {
"group": [2],
"gold": 1,
"silver": 2,
"bronze": 3,
"first": 3,
"suffix": "(专科)"
}
}filepoints to a localeventfeed. If it is non-empty, data is read from that local file; otherwise it is fetched fromurl.benholds the award settings for the undergraduate group andzhuanfor the vocational-college group.grouplists the groups eligible for awards, followed by the gold/silver/bronze counts, the number of top places (first, i.e. champion/runner-up/third), andsuffix, which is appended to the award name. (A singlemedallist would probably be a cleaner design.)
No need to obtain a Basic Authorization key anymore. Login is now done with a username and password.