← CSES Better

The Gangster's Authentication Protocol

INOI · 2005 · Indian National Olympiad in Informatics · INOI0502

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

sets · 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.

State table
Encoded element mCount in other sets < mDecode
mc(m)recover original collection
all K collectionspartition of {1..N}check no missing/repeated elements
  1. 1

    Interpret the encoding

    For each collection, every listed number counts smaller elements outside that collection.
  2. 2

    Recover the original sets

    Use all encoded collections to reconstruct which original values belong to each gangster.
  3. 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 chars

Run output

Run your code to see output.