← CSES Better
Open official problem ↗The Gangster's Authentication Protocol
INOI · 2005 · Indian National Olympiad in Informatics · INOI0502
Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopsets · decoding · counting
The organizer’s problem statement is available at the official source link.
set decoding
Reconstruct the collections from encoded values
Each encoded element is the number of elements in the other collections that are smaller than its original value.
| Encoded element m | Count in other sets < m | Decode |
|---|---|---|
| m | c(m) | recover original collection |
| all K collections | partition of {1..N} | check no missing/repeated elements |
- 1
Interpret the encoding
For each collection, every listed number counts smaller elements outside that collection. - 2
Recover the original sets
Use all encoded collections to reconstruct which original values belong to each gangster. - 3
Verify the partition
The decoded collections partition {1,...,N}: every number appears exactly once.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 charsRun output
Run your code to see output.