Programming contests

ECN programozó csapatverseny, 2019. május 11.

May 11, 2019 10:15 AM – May 11, 2019 3:15 PM

Networks

Given three “equidistant orthogonal networks” of dimensions n × n, m × m, and p × p (see the figure below for a 5 × 5 network; all horizontal and vertical edges are of 1 unit length; all diagonal edges are of √2 length), we are interested in the following three subnetworks:

  • a minimal-length subnetwork that links (directly or indirectly) all the nodes of the network of size n × n;
  • a subnetwork for accessing from the top left node all the other nodes of the network of size m × m in minimal number of steps (or edges);
  • a subnetwork for accessing from the bottom right node all the other nodes of the network of size p × p on minimal-length routes.

Only the number of edges of each subnetwork has to be printed to the standard output.

Input Specification

The input contains three numbers: n, m, and p, separated by a space (2 ≤ nmp ≤ 10 000).

Output Specification

Print three numbers to the standard output, representing the number of edges for each network (separated by a space).

Sample Input

  1. 2019 539 9876
download as text file

Output for Sample Input

  1. 4076360 290520 97535375
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019