Connected Towns

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Pak Dengklek lives in Indonesia, a country consisting of NN towns numbered from 00 to N1N - 1. For every pair of towns, there is a one-way road going from one town to the other. Pak Dengklek has no information on the direction of the roads, but Pak Chanek has offered to help him

Pak Dengklek is allowed to ask Pak Chanek at most 40,00040\\,000 questions. For each question in turn, Pak Dengklek chooses a pair of towns and Pak Chanek tells him the direction of the road connecting those two towns.

Pak Dengklek wants to know a town number with at most one outgoing road, or report if there is no such town. If there is more than one such town, Pak Dengklek only needs to know any of such town numbers.

제한

  • 3N20003 ≤ N ≤ 2000