← CSES Better

Cowntact Tracing

USACO · 2020 · US Open · bronze-3

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

combinatorics · simulation

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

sample trace

Cowntact Tracing: combinatorics walkthrough

Cowntact Tracing: use the linked editorial?s combinatorics, simulation idea on the published sample, then verify the displayed output.

Published input4 3 1100 7 1 2 5 2 3 6 2 4modelAlgorithm ideaCount the valid arrangements by splitting them into disjoint cases or independent choices.task resultExpected output1 1 Infinity
  1. 1

    Cases

    Partition the possible configurations so each valid outcome belongs to one case.
  2. 2

    Count

    Count each case using the independent choices identified by the task.
  3. 3

    Combine

    Sum the disjoint case counts and apply any required modulus or bound.
  4. 4

    Verify the sample

    Use the published sample output to check the result of this idea on the displayed input.
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.