← CSES Better

Count Distinct Possible Exam Scores

ZIO · 2023 · Zonal Informatics Olympiad · P1

Open official problem ↗
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

dynamic-programming · sets · counting

The organizer’s problem statement is available at the official source link.

score state

Each problem adds one of three score changes

A correct answer adds X, an incorrect answer subtracts one, and skipping adds zero; equal final scores count once.

ss-1 | s | s+Xdeduplicate reachable totals
  1. 1

    Start at zero

    Start with reachable score set {0}.
  2. 2

    Extend score choices

    For each problem, extend every score by −1, 0, or X.
  3. 3

    Deduplicate totals

    Deduplicate totals and count the distinct reachable scores.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 chars

Run output

Run your code to see output.