Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Japanese Puzzle
Description A brand-new Japanese puzzle is coming from the East to strike the world-popular Sudoku game and become an international hit. The rules of this puzzle are kept in secret yet, but the goal is already advertised: given a square grid Andy works at the puzzles review magazine, and of course he got interest in this Japanese news. He realized that the information known so far is enough to find the number of equal first rows in a puzzle winning position. Now Andy wants to write a computer program for calculating this number for any given starting configuration. For example, if you are given a puzzle which looks this way:
one of the optimal rearrangements could look like
Input The first line of the input file contains two integers l > 0, sum of all _{i}l is exactly _{i}n^{2}).Output Output the maximal possible number of equal first rows at the first line of the output file. The following Sample Input 3 4 3 3 2 1 Sample Output 2 1 2 3 Source Northeastern Europe 2006, Northern Subregion |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator