版本比较
IOI 2018进入倒计时,赛前闲话IOI
正文
增加 126 行删除 126 行
135 行未改动全部展开136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269229 行未改动全部展开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 "*" 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* 11 1 4 2 2 11 2 3 21The 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. Eachconstraint for a single row or column appears on a single line asa sequence of numbers separated by spaces and terminated by 0.2. Reconstruct the map (or all of the maps, if more then one solutionis 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 blankmust be represented by a pair of spaces. Each island should berepresented by a '*' followed by a space. Different maps satisfyingthe same constraints should be separated by a blank line. If thereis no map satisfying the constraints, indicate it by a line saying"no map". The solutions to the different information blocks must beseparated 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 codedinformation from must be "C:\IOI\DAY-1\413-SEAS.IN".Constraint-4: The name of the ASCII output file for writing themap(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 04 Example-2. Solution: columns: 1 2 3 40 row 1:1 0 row 2: *2 0 row 3: * *0 row 4:01 02 002 Example-3. Note that there is no map0 satisfying the constraints.02 02 02 Example-4. Note that there are two different maps1 0 satisfying the constraints.1 01 01 0SAMPLE 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 行未改动全部展开135 行未改动全部展开136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269229 行未改动全部展开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 "*" 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* 11 1 4 2 2 11 2 3 21The 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. Eachconstraint for a single row or column appears on a single line asa sequence of numbers separated by spaces and terminated by 0.2. Reconstruct the map (or all of the maps, if more then one solutionis 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 blankmust be represented by a pair of spaces. Each island should berepresented by a '*' followed by a space. Different maps satisfyingthe same constraints should be separated by a blank line. If thereis no map satisfying the constraints, indicate it by a line saying"no map". The solutions to the different information blocks must beseparated 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 codedinformation from must be "C:\IOI\DAY-1\413-SEAS.IN".Constraint-4: The name of the ASCII output file for writing themap(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 04 Example-2. Solution: columns: 1 2 3 40 row 1:1 0 row 2: *2 0 row 3: * *0 row 4:01 02 002 Example-3. Note that there is no map0 satisfying the constraints.02 02 02 Example-4. Note that there are two different maps1 0 satisfying the constraints.1 01 01 0SAMPLE 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 行未改动全部展开