← CSES Better

Counting triangles

INOI · 2011 · Indian National Olympiad in Informatics · INOI1101

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

geometry · hashing · counting

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

coordinate cross

Visualize Counting triangles

For each point as a right-angle corner, pair other points sharing its x and y coordinates.

Problem grid; highlighted cells show the illustrated path
.vertical point.
horizontal pointcorner.
...
  1. 1

    Encode the task

    For each point as a right-angle corner, pair other points sharing its x and y coordinates.
  2. 2

    Advance the state

    At corner (x,y), combine every other point on its vertical ray with every point on its horizontal ray.
  3. 3

    Read the result

    Use the final marked state to identify the requested answer.
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.