codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

234G.md (2077B)


      1 Source: https://codeforces.com/problemset/problem/234/G
      2 
      3 G. Practice
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 input.txt
     16 
     17 output
     18 
     19 output.txt
     20 
     21 Little time is left before Berland annual football championship. Therefore the coach of team "Losewille Rangers" decided to resume the practice, that were indefinitely interrupted for uncertain reasons. Overall there are *n* players in "Losewille Rangers". Each player on the team has a number — a unique integer from 1 to *n*. To prepare for the championship, the coach Mr. Floppe decided to spend some number of practices.
     22 
     23 Mr. Floppe spent some long nights of his holiday planning how to conduct the practices. He came to a very complex practice system. Each practice consists of one game, all *n* players of the team take part in the game. The players are sorted into two teams in some way. In this case, the teams may have different numbers of players, but each team must have at least one player.
     24 
     25 The coach wants to be sure that after the series of the practice sessions each pair of players had at least one practice, when they played in different teams. As the players' energy is limited, the coach wants to achieve the goal in the least number of practices.
     26 
     27 Help him to schedule the practices.
     28 
     29 Input
     30 
     31 A single input line contains integer *n* (2 ≤ *n* ≤ 1000).
     32 
     33 Output
     34 
     35 In the first line print *m* — the minimum number of practices the coach will have to schedule. Then print the descriptions of the practices in *m* lines.
     36 
     37 In the *i*-th of those lines print *f**i* — the number of players in the first team during the *i*-th practice (1 ≤ *f**i* < *n*), and *f**i* numbers from 1 to *n* — the numbers of players in the first team. The rest of the players will play in the second team during this practice. Separate numbers on a line with spaces. Print the numbers of the players in any order. If there are multiple optimal solutions, print any of them.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 2
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 1  
     51 1 1
     52 ```
     53 
     54 Input
     55 
     56 ```
     57 3
     58 ```
     59 
     60 Output
     61 
     62 ```
     63 2  
     64 2 1 2  
     65 1 1
     66 ```