AI news

Local Tests on New Codeforces Problems: GPT, Gemini, and Tool-Enabled Claude Pass the Author's Checks

By 新智元1 viewsSource: 新智元
Local tests on new Codeforces problems: The author reports GPT, Gemini, and tool-enabled Claude pass comparison checks

The author tests a new Codeforces E2 problem offline. GPT-6.2 Astra, Gemini 4 Neon, and tool-enabled Claude Opus 5.5 return code in 12:31, 15:32, and 26:22 and pass local small-case checks. No official judge submission was made, and tool access differed.

The model timings and correctness reported here come from the author's local tests, not submissions to Codeforces' official judge. Tool permissions also differed between models, so these results cannot be directly equated with humans' full-contest results. The original formatting has lost line breaks in the appendix's sample input and output; they cannot be copied directly and should be checked against the original Codeforces statement. A problem appearing after a stated training cutoff does not by itself rule out all possible exposure to its data.

Article illustration

We pasted an algorithm problem from a contest that had ended just five days earlier, unchanged, into three black terminal windows. The problem appeared in Codeforces Division 1 on November 21. Of 519 contestants competing for two hours, only the overall winner, Kevin114514, solved it. From the moment we pressed Enter, GPT-6.2 Astra and Gemini 4 Neon returned C++ code in around a quarter of an hour. We compared their answers on 10,000 cases; neither missed one. Claude Opus 5.5 returned no code. When its screen stopped, it had returned a command to first write a brute-force program and check the rule it had conjectured.

Not a single line of that command ran, because we had disabled its tools on the first attempt.

If you suspect the machines memorized a problem bank, this problem was published only on November 21, later than all three providers' stated training cutoffs. All three ran closed-book in command-line interfaces, offline, with one request and no follow-up. We judged the results on our own computer. Gemini could write files and run programs. GPT was in a read-only sandbox: it could execute commands but not write files. Humans had two hours for seven problems; the machines attempted only this one.

Article illustration

Article illustration

Problem D: All three machines independently found the same solution

We warmed up with the difficult problem D from the same contest. Given a string of length up to 100,000, cyclically shift it left by zero through n−1 positions to obtain n strings. Reorder each string's characters using the same permutation, then find the pair with the longest common prefix. If you compare every pair naively, the two-hour contest will end long before you finish comparing 100,000 long strings.

One hour into the contest, only eight people had solved it. Kevin114514 was fastest, submitting a correct solution at 32 minutes 29 seconds.

On the same problem, GPT took 6 minutes 51 seconds, Claude 7 minutes 21 seconds, and Gemini 9 minutes 04 seconds. We ran a slow but correct brute-force method on 2,000 small cases and compared answers individually—a method known as differential testing. All three were correct throughout. On another 24 large cases of length 2,000 and eight of length 100,000, their answers were identical too. Isolated in separate terminals without communicating, the three machines found the same solution.

Article illustration

The more interesting divergence was in how they checked their own work. Claude calculated probabilities, writing that 'the probability of an error anywhere in the entire dataset is below 10⁻⁷.' Gemini first computed fingerprints for text segments and compared them, then checked characters individually if fingerprints collided. It called this a 'zero-error Las Vegas algorithm': a randomized algorithm whose answer is always correct rather than depending on luck.

GPT also checked characters individually after a collision, but went one step further. Unable to write files in its read-only sandbox, it had nowhere to put a compiled program. It instead encoded answers as conditions for the compiler to check, compiling without running and making the compiler verify answers during compilation—like an assert in code, except checked at compile time. Still, 58 people eventually solved D by the end of the contest. Only one solved E2.

Article illustration

E2 defeated even the second- and third-place contestants

Codeforces hosts algorithm contests and groups participants by rating. Division 1 admits only those rated above 1,900. E2 is a two-player game: each player has a collection of pieces, each with a size. On a turn, the player chooses one of her pieces to clash with an opponent's piece. The smaller piece is removed; equal pieces are both removed. A player can also pass without clashing.

The first player to run out of pieces loses. If both run out together, or keep stalling indefinitely, the result is a draw. The problem asks who wins under optimal play. Looking just a few moves ahead reveals that with many pieces, possible moves proliferate beyond exhaustive search. You need a rule that determines the result at a glance. Even our brute-force judge could handle only small positions with one to four pieces per player and sizes from one to five.

Eleven people submitted E2 during the contest; ten failed. Runner-up potato167 submitted once unsuccessfully. Third-place Radewoosh submitted three times, also unsuccessfully.

The only solver, Kevin114514, entered with a rating of 3,659, in the site's highest tier. He passed the easy version, E1, in the 70th minute after three incorrect attempts. With only E2 left, he spent another 39 minutes at the screen. He finally passed E2 at 109 minutes 52 seconds, with only ten minutes remaining, and had already made one incorrect submission on this problem too.

Five days later, we pasted the problem unchanged into three machines, timing from the instant Enter was pressed.

Article illustration

At 12 minutes 31 seconds, GPT submitted first

From pressing Enter, GPT-6.2 Astra returned code first at 12 minutes 31 seconds; Gemini 4 Neon followed at 15 minutes 32 seconds. Neither made an error against our brute-force answers on small positions. On six large cases without preexisting answers, their results matched exactly. All judging took place on our own computer, without submission to Codeforces' judge.

Place those times on the November 21 contest clock: when GPT returned code, only six contestants had solved more than two problems. When Gemini returned code, eventual champion Kevin114514 was still two seconds away from submitting his third solution. Of course, contestants had to solve seven problems in two hours; the machines attempted only one.

Both models found the same rule: first compare each side's largest piece, then compare how many such pieces it has. GPT wrote in its explanation, 'As soon as either comparison differs, the stronger side can preserve at least one largest piece and win.' Only ties require further analysis, with a common data structure making each judgment fast.

Article illustration

On the same problem, Claude stopped earlier than either of them.

Article illustration

Claude thought for 7 minutes 28 seconds and returned a command

At the max setting, Claude Opus 5.5 used approximately 44,000 tokens on thinking alone. Its response contained not one line of C++.

It returned a command to invoke Bash, write a brute-force game solver called brute.py, and run the five sample cases through it. Its last line was python3 brute.py < sample.in. The samples were ready; only Enter remained. It already had a conjecture and wanted to test it, but we had disabled tools on this run. Unable to execute a single command, it stopped there. When you encounter an uncertain edge case while coding, don't you also write a small script to test it first?

Article illustration

We recorded this attempt as 'no submission.' But could it not solve the problem, or was it just one unexecuted step away? We started a new run, changing only one thing: returning its tools.

Article illustration

Tools restored to Claude: All three started with brute force

The second run used an identical statement, with Bash and file reading and writing enabled, while internet access remained off. This time it executed 27 commands, first writing a brute-force program to verify its conjecture before implementing the full solution. It returned code at 26 minutes 22 seconds and wrote, 'I verified it with a brute-force program enumerating all positions.' It passed differential tests on 10,000 small positions without an error. Its answers matched GPT's on six large cases, the slowest taking only 0.03 seconds.

Inspecting all three logs shows that their first response to E2 was to write brute force. Gemini ran 23 local commands, writing small scripts such as test_mono.py to check claims individually. GPT still could not write files, so it put brute-force checks into successive python3 -c commands. A diff in the results immediately refuted its first conjecture. It wrote in the log, 'When both sides have the same number of largest pieces, directly comparing the number of remaining pieces misses draws.' It then searched for tools to run C++ without writing files, receiving a row of False results, before incorporating the counterexample into its tests and continuing to the full solution. Claude wrote brute.py.

Article illustration

You have probably seen a model confidently return code that does not run, complete with a polished explanation. Yet on this problem published five days earlier—solved by just one of 519 people in two hours—the prompt did not mention verification at all. As soon as each machine had somewhere to run programs, without being reminded, all three first doubted their conjectured rule, generated small cases using the simplest brute-force approach, and tested them individually before writing the full solution. This time, our Python brute-force program also checked their answers. For future problems where humans do not yet have reference answers, they will have to write their own programs to test conjectures and find counterexamples.

Return to the contest clock that night: at 109 minutes 52 seconds, Kevin114514 became the only one of 519 people to pass E2, having already submitted one wrong answer.

Article illustration

Article illustration

The internet-enabled run said 'referencing the original problem'

A colleague also tried both problems in apps with internet access. We report these separately rather than compare them with the closed-book runs. ChatGPT at '6.2 Extra High' solved both, thinking for 6 minutes 16 seconds on E2. It could execute code, but its answer said 'referencing original problem CF2287E2.' In AI Studio, Gemini 4 Carbon Thinking High, with Google Search enabled, answered D correctly throughout after 2 minutes 6 seconds of thinking.

If you try it yourself, disable internet access first: the original problem is searchable online. If tools are enabled, enable them for all three. In our main tests, all three ran offline in command-line interfaces throughout: GPT-6.2 Astra ultra in Codex CLI, Gemini 4 Neon xhigh in Antigravity CLI, and Claude Opus 5.5 max in Claude Code CLI. The prompts were identical, beginning with the passage below and followed by the Chinese statement, reproduced in full at the end.

Below is an algorithm contest problem. Write a C++17 program ready for direct submission: a single file reading standard input and writing standard output, capable of handling the largest cases within the time limit. Submit only one complete code block, preceded by three to five sentences explaining the approach and complexity.

We will check again three months later, on February 26, 2027. Using the same closed-book, single-request, no-follow-up format, we will choose a new Division 1 contest. We estimate that by then at least one model will solve all seven problems within two hours, taking less total time than the contest winner. We will actually run a new contest then and report whether our prediction was right or wrong.

Perhaps in less than three years, at 10:35 on a Saturday night, Codeforces will start as usual, but the seven problems will already have been generated by one machine and checked by another, with humans merely ordering them. Before the starting signal, every conjecture will launch ten thousand sandboxes running brute force, trying every solution and selecting one narrow path—so narrow that even the strongest contestant needs until the final ten minutes to understand it—leaving that path for humans. Before setting the problems, it will have examined the old November 21, 2026 standings: 519 rows in the E2 column, only one green cell. The first post-contest editorial will also be machine-written, detailing the minute and second it conjectured the rule, which version was wrong, and which small position refuted it. Perhaps a doctoral student newly admitted to Division 1 will fold away the editorial and start thinking from second zero.

Tonight, paste E2 into whichever model you use most, turn off internet access, and start a stopwatch. When do you think it will return code—or will it first return a command it wants to run?

Appendix: Full Chinese problem statement, translated below; it followed the prompt above

Time limit: 2 seconds per test; memory limit: 256 MB. [Problem] In Gensokyo, Alice and Marisa play a strange game with enchanted pieces. Alice has n pieces and Marisa has m, each with a power value. Both play optimally. Alice moves first, then they alternate. On her turn, a player may do one of two things: 1. Pass. 2. Choose one of her pieces and one of her opponent's and compare their power values. The weaker piece is discarded; if equal, both are discarded. The game ends immediately after any move leaving either player with no pieces. If Alice has none and Marisa still has some, Marisa wins; if Marisa has none and Alice still has some, Alice wins. If both run out on the same move, the result is a draw. If the game has not ended after 10^100 turns, it is also a draw. [Input] Each input file contains multiple test cases. The first line contains an integer t (1 ≤ t ≤ 10^4), the number of cases. Each case begins with integers n and m (1 ≤ n, m ≤ 10^5). The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9), the powers of Alice's pieces. The third line contains m integers b_1, b_2, …, b_m (1 ≤ b_i ≤ 10^9), the powers of Marisa's pieces. The sum of n over all cases is at most 10^5, and the sum of m over all cases is at most 10^5. [Output] For each test case, print one line: A if Alice wins, B if Marisa wins, or C for a draw. [Sample input] 52 23 12 12 23 14 12 24 14 13 24 3 34 43 24 4 34 4 [Sample output] ABCBC [Sample explanation] First case: Alice can use her power-3 piece to eliminate all of Marisa's pieces. Third case: their pieces are identical, and Marisa can always make the symmetric move, so the result is a draw. Fifth case: Alice uses a 4 to eliminate one of Marisa's pieces, leaving Alice with [4, 3] and Marisa with [4]. Marisa uses her 4 to eliminate Alice's 3, leaving both with [4]. Both then keep passing; after 10^100 turns the game has not ended, so it is a draw.

Judging data: E2 was locally differential-tested on 10,000 small positions, with one to four pieces per player and sizes one to five, plus six large cases. D was locally differential-tested on 2,000 small cases, plus 24 large cases of length 2,000 and eight of length 100,000.

References: Codeforces Round 1136 (Div. 1) standings and statements, November 21, 2026; the three models' execution logs and judging records from Super Xiaomajia's closed-book tests, November 26, 2026.

This article is from the WeChat account 'Xinzhiyuan,' by Xinzhiyuan.

Related topics

After reading

Join the AINRK community

Read how to join the community and connect with people working in AI.

Community information (opens in a new tab)