PivotOJ

Longest Trip

시간 제한: 1000ms메모리 제한: 1024MB출처: IOI 2023BOJ 29746

문제

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 NN landmarks at Ópusztaszer indexed from 00 to N1N-1. 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 δ\delta if every 33 distinct landmarks have at least δ\delta roads among them. In other words, for each triplet of landmarks (u,v,w)(u, v, w) such that 0u<v<w<N0 \le u \lt v \lt w \lt N, among the pairs of landmarks (u,v),(v,w)(u,v), (v,w) and (u,w)(u,w) at least δ\delta pairs are connected by a road.

The organizers know a positive integer DD such that the density of the road network is at least DD. Note that the value of DD cannot be greater than 33.

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 [A[0],,A[P1]][A[0], \ldots, A[P-1]] and [B[0],,B[R1]][B[0], \ldots, B[R-1]] must be specified. The landmarks must be pairwise distinct, that is,

  • A[i]A[j]A[i] \neq A[j] for each ii and jj such that 0i<j<P0 \le i \lt j \lt P;
  • B[i]B[j]B[i] \neq B[j] for each ii and jj such that 0i<j<R0 \le i \lt j \lt R;
  • A[i]B[j]A[i] \neq B[j] for each ii and jj such that 0i<P0 \le i \lt P and 0j<R0\le j \lt R.

For each call, the dispatcher reports whether there is a road connecting a landmark from AA and a landmark from BB. More precisely, the dispatcher iterates over all pairs ii and jj such that 0i<P0 \le i \lt P and 0j<R0\le j \lt R. If, for any of them, the landmarks A[i]A[i] and B[j]B[j] are connected by a road, the dispatcher returns true. Otherwise, the dispatcher returns false.

A trip of length ll is a sequence of distinct landmarks t[0],t[1],,t[l1]t[0], t[1], \ldots, t[l-1], where for each ii between 00 and l2l-2, inclusive, landmark t[i]t[i] and landmark t[i+1]t[i+1] are connected by a road. A trip of length ll is called a longest trip if there does not exist any trip of length at least l+1l+1.

Your task is to help the organizers to find a longest trip at Ópusztaszer by making calls to the dispatcher.

이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.