#P1640. [SCOI2010] 连续攻击游戏

    ID: 626 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>2010四川并查集各省省选二分图

[SCOI2010] 连续攻击游戏

Description

lxhgww recently got hooked on a game. In the game, he owns many pieces of equipment, and each piece has 22 attributes. The values of these attributes are numbers in [1,10000][1,10000]. When he uses a piece of equipment, he can only use one of its attributes, and each piece of equipment can be used at most once.

At the end of the game, lxhgww encounters the final boss. This boss is peculiar: to deal damage, the attribute values used to attack must increase consecutively starting from 11. That is, at the beginning lxhgww can only attack the boss with a piece of equipment whose attribute value is 11, then only with a piece whose attribute value is 22, then only with a piece whose attribute value is 33, and so on. Now lxhgww wants to know the maximum number of consecutive attacks he can make on the boss.

Input Format

The first line contains an integer NN, the number of types of equipment lxhgww owns. The next NN lines describe these NN types of equipment. Each line contains 22 numbers, the 22 attribute values of the ii-th piece of equipment.

Output Format

Output one line with 11 number: the maximum number of consecutive attacks lxhgww can make.

3
1 2
3 2
4 5

2

Hint

For 30%30\% of the testdata, N103N \le 10^3.

For 100%100\% of the testdata, N106N \le 10^6.

Translated by ChatGPT 5