Longest Trip
문제
The IOI 2023 organizers are in big trouble! They forgot to plan the trip to Ópusztaszer for the upcoming day. But maybe it is not yet too late ...
There are landmarks at Ópusztaszer indexed from to . Some pairs of these landmarks are connected by bidirectional roads. Each pair of landmarks is connected by at most one road. The organizers don't know which landmarks are connected by roads.
We say that the density of the road network at Ópusztaszer is at least if every distinct landmarks have at least roads among them. In other words, for each triplet of landmarks such that , among the pairs of landmarks and at least pairs are connected by a road.
The organizers know a positive integer such that the density of the road network is at least . Note that the value of cannot be greater than .
The organizers can make calls to the phone dispatcher at Ópusztaszer to gather information about the road connections between certain landmarks. In each call, two nonempty arrays of landmarks and must be specified. The landmarks must be pairwise distinct, that is,
- for each and such that ;
- for each and such that ;
- for each and such that and .
For each call, the dispatcher reports whether there is a road connecting a landmark from and a landmark from . More precisely, the dispatcher iterates over all pairs and such that and . If, for any of them, the landmarks and are connected by a road, the dispatcher returns true. Otherwise, the dispatcher returns false.
A trip of length is a sequence of distinct landmarks , where for each between and , inclusive, landmark and landmark are connected by a road. A trip of length is called a longest trip if there does not exist any trip of length at least .
Your task is to help the organizers to find a longest trip at Ópusztaszer by making calls to the dispatcher.