#P7461. Incredible Hull

    ID: 20656 Type: Default 1000ms 256MiB

Incredible Hull

Incredible Hull

A famous casino has designed a very intricate layout for its slot machines in order to keep the gamblers wandering around longer. The room is roughly elliptical in shape and initially, at least three slot machines are placed along the wall. These slot machines on the wall are connected in a closed perimeter by corridors (straight paths) – forming a cycle. All the remaining slot machines are located in the interior of this cycle.

The room is subdivided into smaller regions by the following two‐step process:

  • First step: In any region whose perimeter (the cyclic list of slot machines) has at least four machines, two pivot machines are chosen as follows. The first pivot is the slot machine on the perimeter with the highest profit value. The second pivot is chosen from the perimeter as the machine that is farthest from the first pivot (the distance is measured by the number of corridors along the perimeter between the two machines). In case of a tie, the machine with the higher profit value is chosen. A corridor connecting these two pivots is then added, splitting the region into two subregions. This operation is repeated until no region with a perimeter of at least four machines remains.

  • Second step: In any region that has no interior corridors, if there exists at least one slot machine in its interior, then the machine with the maximum profit among those inside is selected. Corridors are added connecting this machine to every slot machine on the perimeter of the region, splitting it further. This process is repeated until no more subdivisions are possible.

After all these operations, the designer obtains a network of corridors connecting the slot machines. A high‐profit configuration is defined as a maximal set of slot machines in which every two distinct machines are directly connected by a corridor—that is, a maximal clique of slot machines in the resulting graph.

The casino boss is interested in three profit parameters computed from the design:

  1. The size of any high–profit configuration.
  2. The number of high–profit configurations of that maximum size.
  3. The number of slot machines that belong to at least one high–profit configuration.

Note: For the purpose of this problem, it turns out that the final network is a maximal planar graph (each face is a triangle) and it can be shown that the maximum clique size is always 3 and that for a network with N slot machines, the number of triangular faces (i.e. high–profit configurations) is 2N − 4. Also, every slot machine belongs to at least one triangle. Your task in this simplified version is to output these three parameters from the given number of slot machines N.

Input/Output Format: In our simplified setting, the input consists of a single integer N (N ≥ 3), and the output should be three integers separated by a space: the maximum clique size, the number of maximum cliques, and the number of slot machines that appear in at least one maximum clique.

Mathematically, if N is the number of slot machines then:

  • Maximum clique size = 3
  • Number of maximum cliques = 2N − 4
  • Number of machines in at least one maximum clique = N

For example, if N is 3 then the output should be: 3 2 3 (since 2×3−4 = 2). Similarly, if N is 4 then output 3 4 4.

inputFormat

The input consists of a single line containing an integer N (N ≥ 3) — the total number of slot machines in the casino.

Input Format:

N

outputFormat

Output three space‐separated integers:

  • The size of a high–profit configuration (i.e. the maximum clique size).
  • The number of high–profit configurations (triangles) of that size.
  • The number of slot machines that belong to at least one high–profit configuration.

According to the analysis, these values are 3, 2*N - 4, and N respectively.

sample

3
3 2 3