← All problemsSign in

BLACK LINE

CodeChefRating 2354Open on judge ↗

This is an **interactive problem**. It means that every time you output something, you must finish with a newline character and flush the output. For example, in C++ use the $fflush(stdout)$ function, in Java — call $System.out.flush()$, in Python — $sys.stdout.flush()$, and in Pascal — $flush(output)$. Only after flushing the output will you be able to read from the input again. There exists a s

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start