CSP-S 2026 Travelogue

CSP-S 2026 travelogue (with annotations)

Hua'er Purple Bamboo, 2026-10-31T14:30+08:00~2026-10-31T18:30+08:00.

timeline (git commit history):

  • 14: 39 init (with diff.sh)
  • 14:58 T1 45 pts
  • 15:26 T1 100 pts
  • 15: 34 wrote gen for T1
  • 16: 04 T2 20pts (actual 36 pts)
  • 16: 15 T2 60 pts (actual 68 pts)
  • 16: 19 T2 open long long
  • 16: 22 T1 discovered a variable that was not enabled with 'long long' (thank you diff.sh)
  • 16: 50 wrote 'gen' for T2 (however, the data from 'gen' does not guarantee graph connectivity, leading to many misjudgments in this exam room)
  • 17: Due to data issues with the construction of T2 gen, unnecessary long and special judgments were caused
  • 17: 59 is still stuck in T2, T3 and T4 have no progress
  • At around 18:20, T2 was found to be fine and attempts were made to write T3 and T4 violence, but time was not enough

T1

At first, I thought the answer was about monotonic numbers that are ultimately equal, so I wanted to write binary. However, I found that the second example falsified this conclusion. Discovering that the final identical number must be ai(i∈[one,n])a_i (i \in [1, n]).

I wrote one first 45 points of violenceAt this point, the exam has started for 28 minutes.

Considering the use of binary prefix and optimizationThe process of searching for ansHowever, because the answers obtained from binary analysis were consistently one more or one less, it resulted inThese lines of code (laughing and crying).

However, at the beginning The 'now' function of checkb is not enabled. 'long long' is not enabledAlmost 100->65, diff.sh made great contributions.

Appendix gen.cpp.

T2

Actually, I came up with it 34 minutes into the examEach of the 500 lines is considered as a point on the map, connected to a subway stationHowever, due to the absence of negative edge weights, dij naturally came to mind, and preprocessing optimization was later added. After writing at 16:15, it was found that the last two large examples (3s) could not be passed. However, I did not expect it O(nthree)O(n^3) Floyd is faster in this situation. At the time of writing this record, the official results had not yet been released, so if CCF's evaluation machine had put in effort, it might have scored more points. )

Appendix gen.cppPlease note that the graph generated by gen.cpp does not guarantee connectivity, so if the code outputs' nf 'or negative numbers, it is usually due to graph disconnection and can be ignored.

T3 T4

Due to the fact that T2 did not even mention violence, I suffered a loss of 20-60 points.

Summary

  1. Make great contributions to filming and diff.sh.
  2. Due to the fact that random numbers only use time (0) as a seed, the shooting efficiency greatly decreases, and it took half an hour of continuous shooting to discover the T1 issue.
  3. Excessive hitting T2 resulted in T3 and T4 violence not being written.
  4. There was an incorrect estimation of algorithm complexity (dij) and neglect of obscure algorithm (Floyd), resulting in T2 100->68.

Attached diff.sh (Linux, note that no file opening or reading/writing is required for the shooting code):

#!/bin/bash

g++ sol1.cpp -o sol1 -O2 -std=c++14 -static
g++ sol2.cpp -o sol2 -O2 -std=c++14 -static
g++ gen.cpp -o gen -O3 -std=c++14 -static
for i in {1..10000}; do
    gen > in
    sol1 < in > a
    sol2 < in > b
    if ! diff -q a b > /dev/null; then
        echo wa
        cp in wa.in
        cp a wa1.out
        cp b wa2.out
        break
    fi
    echo success $i
done

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注