This commit is contained in:
Barrett Ruth 2025-11-04 23:39:43 -05:00
parent 6a1534124d
commit 127de3d6a5
3 changed files with 18 additions and 6 deletions

View file

@ -40,15 +40,17 @@ COMMANDS *cp-commands*
Execution modes: Execution modes:
• :CP run Combined: single execution with all tests • :CP run Combined: single execution with all tests
(auto-switches to individual when multiple samples)
• :CP run all Individual: N separate executions • :CP run all Individual: N separate executions
• :CP run n Individual: run test n only • :CP run n Individual: run test n only
• :CP run n,m,... Individual: run specific tests (e.g. nth and mth) • :CP run n,m,... Individual: run specific tests (e.g. nth and mth)
--debug: Use debug build (builds to build/<name>.dbg) --debug: Use debug build (builds to build/<name>.dbg)
Combined mode mimics platform behavior in order to accurately Combined mode runs all test inputs in one execution (matching
simulate online judge environments. Individual mode provides platform behavior for multi-test problems). When a problem has
per-test verdicts. multiple independent sample test cases, :CP run auto-switches to
individual mode to run each sample separately.
Examples: > Examples: >
:CP run " Combined: all tests, one execution :CP run " Combined: all tests, one execution
@ -556,18 +558,20 @@ Execution Modes ~
The I/O view supports two execution modes: The I/O view supports two execution modes:
Combined Mode (default: :CP run) Combined Mode (:CP run with single sample)
• Single execution with all test inputs concatenated • Single execution with all test inputs concatenated
• Matches platform behavior (e.g. Codeforces multi-test format) • Matches platform behavior (e.g. Codeforces multi-test format)
• Shows one verdict for the entire execution • Shows one verdict for the entire execution
• Input split: All test inputs concatenated • Input split: All test inputs concatenated
• Output split: Single program output + verdict • Output split: Single program output + verdict
• Used when problem has one sample containing multiple test cases
Individual Mode (:CP run all / :CP run n / :CP run n,m,...) Individual Mode (:CP run all / :CP run n / :CP run n,m,...)
• Separate execution for each test case • Separate execution for each test case
• Per-test verdicts for debugging • Per-test verdicts for debugging
• Input split: Selected test inputs concatenated • Input split: Selected test inputs concatenated
• Output split: All test outputs concatenated + per-test verdicts • Output split: All test outputs concatenated + per-test verdicts
• Auto-selected when problem has multiple independent samples
Layout ~ Layout ~

View file

@ -358,6 +358,13 @@ function M.run_io_view(test_indices_arg, debug, mode)
return return
end end
if mode == 'combined' then
local test_cases = cache.get_test_cases(platform, contest_id, problem_id)
if test_cases and #test_cases > 1 then
mode = 'individual'
end
end
M.ensure_io_view() M.ensure_io_view()
local run = require('cp.runner.run') local run = require('cp.runner.run')

View file

@ -71,7 +71,7 @@ def _retry_after_requests(details):
on_backoff=_retry_after_requests, on_backoff=_retry_after_requests,
) )
def _fetch(url: str) -> str: def _fetch(url: str) -> str:
r = _session.get(url, headers=HEADERS, timeout=TIMEOUT_SECONDS) r = _session.get(url, headers=HEADERS, timeout=TIMEOUT_SECONDS, verify=False)
if r.status_code in RETRY_STATUS: if r.status_code in RETRY_STATUS:
raise requests.HTTPError(response=r) raise requests.HTTPError(response=r)
r.raise_for_status() r.raise_for_status()
@ -243,7 +243,8 @@ def _to_problem_summaries(rows: list[dict[str, str]]) -> list[ProblemSummary]:
async def _fetch_all_contests_async() -> list[ContestSummary]: async def _fetch_all_contests_async() -> list[ContestSummary]:
async with httpx.AsyncClient( async with httpx.AsyncClient(
limits=httpx.Limits(max_connections=100, max_keepalive_connections=100) limits=httpx.Limits(max_connections=100, max_keepalive_connections=100),
verify=False,
) as client: ) as client:
first_html = await _get_async(client, ARCHIVE_URL) first_html = await _get_async(client, ARCHIVE_URL)
last = _parse_last_page(first_html) last = _parse_last_page(first_html)