← CSES Better

Sequence Land

INOI · 2013 · Indian National Olympiad in Informatics · INOI1302

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 · graph · connected-components

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

overlap graph

Build the President’s extended family as a graph

Two residents connect when their ID sets share at least K values; relatives of relatives form a connected component. Schematic structure only; vertices and edges represent the task relation, not an official sample. Schematic graph only; labels and edges show the task relation, not an official sample.

shared >= Kshared >= KResident AResident BResident C
  1. 1

    Connect related IDs

    Represent each resident by a set of ID values.
  2. 2

    Traverse from President

    Connect two vertices when their intersection meets the threshold.
  3. 3

    Count the component

    Traverse from the President and count every reached resident.
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.