From f89084d0074299c679d10431bda01d819221f7ae Mon Sep 17 00:00:00 2001 From: Wenyuan Huang <157926136+whuang369@users.noreply.github.com> Date: Thu, 10 Sep 2026 10:47:16 -0700 Subject: [PATCH] Fix #185: align problem 213 checker with the documented output format The statement specifies three integers per operation (l r direction), and the sample plus every answer file use that format, but chk.cc read only two: `x=ouf.readInt(); y=x+m-1; z=ouf.readInt();`. It derived the right endpoint from the segment length and then consumed `r` as the direction, so the first ordinary operation was misparsed and any statement-compliant submission was rejected before scoring. The repo's own testdata answers failed against it. - chk.cc: read l, r and d as three separate integers, keeping the existing interval-length, bounds and direction validation. - testdata/1.ans: replace an invalid answer (x=3 for n=2, and an operation with no direction) with `2 / 1 / 1 2 0`. - statement.txt: describe x and m on separate lines, matching the sample and the answer files, and spell out the l/r/d constraints. - config.yaml: raise the time limit to the documented 5s. Verified: all three testdata answers now score (1.0, 0.9577, 0.9952), the statement's sample scores 1.0, and illegal outputs (wrong interval length, r > n, direction not in {0,1}) are still rejected. Co-Authored-By: Claude Opus 5 (1M context) --- algorithmic/problems/213/chk.cc | 2 +- algorithmic/problems/213/config.yaml | 2 +- algorithmic/problems/213/statement.txt | 6 ++++-- algorithmic/problems/213/testdata/1.ans | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/algorithmic/problems/213/chk.cc b/algorithmic/problems/213/chk.cc index 1b0450d30..fb69361bb 100644 --- a/algorithmic/problems/213/chk.cc +++ b/algorithmic/problems/213/chk.cc @@ -59,7 +59,7 @@ int main(int argc,char* argv[]) root=merge(root,newnode(b[i])); while(tot--){ int u,v,x1,x2,x3,x4,x5; - x=ouf.readInt(); y=x+m-1; z=ouf.readInt(); + x=ouf.readInt(); y=ouf.readInt(); z=ouf.readInt(); if(x>y) swap(x,y); if(y-x+1!=m || x<=0 || y>n || (z!=0 && z!=1)) quitf(_wa,"Your answer is not legal"); diff --git a/algorithmic/problems/213/config.yaml b/algorithmic/problems/213/config.yaml index eb050889e..1bdf34e0b 100644 --- a/algorithmic/problems/213/config.yaml +++ b/algorithmic/problems/213/config.yaml @@ -5,7 +5,7 @@ type: default checker: chk.cc # Time and memory limits (for submit answer problems, these may not be strictly enforced) -time: 2s +time: 5s memory: 512m # The subtasks section diff --git a/algorithmic/problems/213/statement.txt b/algorithmic/problems/213/statement.txt index 5d32a1d8d..52acb02ea 100644 --- a/algorithmic/problems/213/statement.txt +++ b/algorithmic/problems/213/statement.txt @@ -13,9 +13,11 @@ The first line contains a single integer $n$. The second line contains $n$ integers, representing the sequence $a$. Output Format: -The first line contains two integers $x$ and $m$, where $m$ represents the number of operations. +The first line contains a single integer $x$, the chosen segment length. -The next $m$ lines each contain three integers: the first two represent the shift interval, and the last one represents the direction, where $0$ means left and $1$ means right. +The second line contains a single integer $m$, the number of operations. + +The next $m$ lines each contain three integers $l$, $r$, $d$: the first two represent the shift interval (it must satisfy $r - l + 1 = x$, $1 \le l \le r \le n$), and the last one represents the direction, where $0$ means left and $1$ means right. Example: Input: diff --git a/algorithmic/problems/213/testdata/1.ans b/algorithmic/problems/213/testdata/1.ans index 62ea367b3..29c7001d2 100644 --- a/algorithmic/problems/213/testdata/1.ans +++ b/algorithmic/problems/213/testdata/1.ans @@ -1,3 +1,3 @@ -3 +2 1 -1 2 +1 2 0