If My Memory Doesn't Fail Me...

시간 제한2초메모리 제한1024 MB

요약
N대의 컴퓨터, M개의 검사 장치, 완전 검사에 K시간이 걸릴 때 전체 검사를 끝내는 최소 시간과 이를 달성하는 장치 연결·해제 일정을 구한다.
난이도

어려움10점 중 8점

유형
수학, 그리디, 시뮬레이션
정답자
아직 제출이 없습니다

문제

John Cameroff, a widely known film director, is preparing for shooting of his next film, "Smiley". There will be lots of modern 3-D visual computer effects in the film. It will definetely lead to unprecedented success. More specifically, in the first week it is planned to gather less than 1000000000 milligrams of smashed tomatoes and rotten eggs that will be thrown to the cinema screens by indignant spectators.

John has calculated everything thoroughly. To make the photographic quality of visual effects, he needs NN computers which he plans to buy at the computer stall nearby. To make sure that the computers are of the highest quality, he decided to test the RAM of each of the computers. He has even bought MM USB devices designed specially for that.

Each of these devices, when plugged into a computer, tests more and more cells of RAM. It takes KK hours for one computer to be tested completely. If one unplugs a device from a computer, the memory checking process is paused. If then one plugs a device again (the same, or another one), the process resumes from the point where it stopped previously. Nothing bad will happen if the device remains plugged after all memory is checked.

John Cameroff appreciates his time. So he wants to know what is the minimal possible time for NN computers to be tested. Moreover, he wants to know the sequence of actions that leads to this result. Your task is to help him to solve this problem.

입력

The first line of the input file contains three integers NN, MM and KK (1≤N,M,K≤10001 \le N, M, K \le 1000).

출력

In the first line of the output file print the minimal time T_minT\_{min}, which takes all computers to be tested. The time should be printed as an irreducible fraction in the format A/B, where AA is the numerator and BB is the denominator. The following inequations should be true: 0≤A≤1090 \le A \le 10^9, 1≤B≤1091 \le B \le 10^9.

In the second line, print the number of actions CC. Each of the following CC lines should contain information about an action in the following format:

Ni/Di: Connect Vi to Ki

This means that after N_iD_i\frac{N\_i}{D\_i} hours from the beginning of the testing the device with number V_iV\_i (1≤V_i≤M1 \le V\_i \le M) should be plugged to the computer with number K_iK\_i (1≤K_i≤N1 \le K\_i \le N). If the device V_iV\_i has been plugged to any computer, it is unplugged first. If some device was plugged to computer K_iK\_i, it is also unplugged.

Fractions N_iD_i\frac{N\_i}{D\_i} should all be irreducible. For numbers N_iN\_i, D_iD\_i the following inequations should be true: 0≤N_i≤1090 \le N\_i \le 10^9, 1≤D_i≤1091 \le D\_i \le 10^9.

The actions must be printed in the order of nondecreasing of time. The number of actions CC should not exceed 1000010000.

If there are several possible sequences of actions that take the minimal time to be executed and satisfy the constraints on the number of actions, output any one.

예제2

  1. 예제 1

    입력
    2 2 1
    
    예상 출력
    1/1
    2
    0/1: Connect 2 to 1
    0/1: Connect 1 to 2
    
  2. 예제 2

    입력
    3 2 1
    
    예상 출력
    3/2
    4
    0/1: Connect 1 to 1
    0/1: Connect 2 to 2
    1/2: Connect 1 to 3
    1/1: Connect 2 to 1