版本比较
IOI 2018进入倒计时,赛前闲话IOI
正文
增加 126 行删除 126 行
135 行未改动全部展开136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269229 行未改动全部展开135 行未改动全部展开
我们注意到只有上古时期的IOI 1992曾经批量生产了AK IOI。[这一年的T1](http://www.ioinformatics.org/locations/ioi92/tasks92.txt)是这样的:
```"ISLANDS IN THE SEA" The SEA is represented by an N times N grid. Each ISLAND is a "*" on that grid. The task is to reconstruct a MAP of islands only from some CODED INFORMATION about the horizontal and vertical distribution of the islands. To illustrate this code, consider the following map: * * * 1 2 * * * * 3 1 * * * 1 1 1 * * * * * 5 * * * * 2 1 1 * 1 1 1 4 2 2 1 1 2 3 2 1 The numbers on the right of each row represent the order and size of the groups of islands in that rows. For example, "1 2" in the first row means that this row contains a group of one island followed by a group of two islands; with sea of arbitrary length to the left and right of each island group. Similarly, the sequence "1 1 1" below the first column means that this column contains three groups with one island each, etc. PROBLEM STATEMENT ================= Implement a program which repeats the following steps until a given input file containing several information blocks has been read completely: 1. Read the next information block from an ASCII input file (for the data structure of that file see also the examples below) and display it on the screen. Each information block consists of the size of the square grid, followed by the row constraints and the column constraints. Each constraint for a single row or column appears on a single line as a sequence of numbers separated by spaces and terminated by 0. 2. Reconstruct the map (or all of the maps, if more then one solution is possible, see Example-4) and display it/them on the screen. 3. Write the map(s) to the end of an ASCII output file. Each blank must be represented by a pair of spaces. Each island should be represented by a '*' followed by a space. Different maps satisfying the same constraints should be separated by a blank line. If there is no map satisfying the constraints, indicate it by a line saying "no map". The solutions to the different information blocks must be separated by a line saying "next problem". TECHNICAL CONSTRAINTS ===================== Constraint-1: N must be not less than 1 and not larger than 8. Constraint-2: Put your solution program into an ASCII text file named "C:\IOI\DAY-1\413-PROG.xxx". Extension .xxx is: - .BAS for BASIC programs, .C for C programs, - .LCN for LOGO programs, .PAS for PASCAL programs. Constraint-3: The name of the ASCII input file for reading the coded information from must be "C:\IOI\DAY-1\413-SEAS.IN". Constraint-4: The name of the ASCII output file for writing the map(s) to must be "C:\IOI\DAY-1\413-SEAS.OU". EXAMPLE(S) ========== 6 Example-1 (the problem above): 6 is the size of the grid. 1 2 0 <-- The start of the first line constraint 3 1 0 1 1 1 0 5 0 2 1 1 0 1 0 1 1 1 0 <-- The start of the first column constraint 1 2 0 4 0 2 3 0 2 0 1 2 0 4 Example-2. Solution: columns: 1 2 3 4 0 row 1: 1 0 row 2: * 2 0 row 3: * * 0 row 4: 0 1 0 2 0 0 2 Example-3. Note that there is no map 0 satisfying the constraints. 0 2 0 2 0 2 Example-4. Note that there are two different maps 1 0 satisfying the constraints. 1 0 1 0 1 0 SAMPLE FILES ============ We provided these correct example files for your convenience: "C:\IOI\DAY-1\413-SEAS.IN" and "C:\IOI\DAY-1\413-SEAS.OU". WARNING: Successful execution of your program with these examples does not necessarily guarantee that your program is correct !!! CREDITS ======= Read an information block from the input file and display it .............................. 5 points Process all information blocks one by one until the input file is read completely .................... 10 points Reconstruct one map for each information block (if it has a solution) and display it ................ 35 points Write the solution map to the output file .................. 5 points Reconstruct all possible maps (if there are several solutions) and display them .................... 20 points Write all solution maps correctly separated to the output file ............................... 10 points Identify information blocks having no solution ............. 5 points Technical constraints completely obeyed .................... 10 points ---------------------------------------------------------------------- maximal 100 points "ISLANDS IN THE SEA"The SEA is represented by an N times N grid. Each ISLAND is a "*" onthat grid. The task is to reconstruct a MAP of islands only from someCODED INFORMATION about the horizontal and vertical distribution ofthe islands. To illustrate this code, consider the following map:
* * * 1 2 * * * * 3 1* * * 1 1 1 * * * * * 5* * * * 2 1 1 * 1
1 1 4 2 2 11 2 3 21
The numbers on the right of each row represent the order and size ofthe groups of islands in that rows. For example, "1 2" in the firstrow means that this row contains a group of one island followed by agroup of two islands; with sea of arbitrary length to the left andright of each island group. Similarly, the sequence "1 1 1" below thefirst column means that this column contains three groups with oneisland each, etc.
PROBLEM STATEMENT=================Implement a program which repeats the following steps until a giveninput file containing several information blocks has been readcompletely:
1. Read the next information block from an ASCII input file (for the data structure of that file see also the examples below) and display it on the screen. Each information block consists of the size of the square grid, followed by the row constraints and the column constraints. Each constraint for a single row or column appears on a single line as a sequence of numbers separated by spaces and terminated by 0.2. Reconstruct the map (or all of the maps, if more then one solution is possible, see Example-4) and display it/them on the screen.3. Write the map(s) to the end of an ASCII output file. Each blank must be represented by a pair of spaces. Each island should be represented by a '*' followed by a space. Different maps satisfying the same constraints should be separated by a blank line. If there is no map satisfying the constraints, indicate it by a line saying "no map". The solutions to the different information blocks must be separated by a line saying "next problem".
TECHNICAL CONSTRAINTS=====================Constraint-1: N must be not less than 1 and not larger than 8.Constraint-2: Put your solution program into an ASCII text file named "C:\IOI\DAY-1\413-PROG.xxx". Extension .xxx is: - .BAS for BASIC programs, .C for C programs, - .LCN for LOGO programs, .PAS for PASCAL programs.Constraint-3: The name of the ASCII input file for reading the coded information from must be "C:\IOI\DAY-1\413-SEAS.IN".Constraint-4: The name of the ASCII output file for writing the map(s) to must be "C:\IOI\DAY-1\413-SEAS.OU".
EXAMPLE(S)==========6 Example-1 (the problem above): 6 is the size of the grid.1 2 0 <-- The start of the first line constraint3 1 01 1 1 05 02 1 1 01 01 1 1 0 <-- The start of the first column constraint1 2 04 02 3 02 01 2 0
4 Example-2. Solution: columns: 1 2 3 40 row 1:1 0 row 2: *2 0 row 3: * *0 row 4:01 02 00
2 Example-3. Note that there is no map0 satisfying the constraints.02 02 0
2 Example-4. Note that there are two different maps1 0 satisfying the constraints.1 01 01 0
SAMPLE FILES============We provided these correct example files for your convenience:"C:\IOI\DAY-1\413-SEAS.IN" and "C:\IOI\DAY-1\413-SEAS.OU".
WARNING: Successful execution of your program with these examplesdoes not necessarily guarantee that your program is correct !!!
CREDITS=======Read an information block fromthe input file and display it .............................. 5 pointsProcess all information blocks one by oneuntil the input file is read completely .................... 10 pointsReconstruct one map for each informationblock (if it has a solution) and display it ................ 35 pointsWrite the solution map to the output file .................. 5 pointsReconstruct all possible maps (if thereare several solutions) and display them .................... 20 pointsWrite all solution maps correctlyseparated to the output file ............................... 10 pointsIdentify information blocks having no solution ............. 5 pointsTechnical constraints completely obeyed .................... 10 points---------------------------------------------------------------------- maximal 100 points
```
还以为这题有多难呢,原来$1\leq n\leq8$。
229 行未改动全部展开