History Grading

题意翻译

先给出$n$个事件的正确发生时间顺序,在给出一些学生排出来的时间发生时间顺序,有两种得分方式:  在相应的时间点发生事件相同则得$1$分  可以得到的分数等于发生事件的相对时间顺序正确的最长长度。 求按照第二种方式可以获得的得分。 $n$的范围,$2<=n<=20$

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=47 [PDF](https://uva.onlinejudge.org/external/1/p111.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA111/5d2a71a05bd8cf7fb9a417c6e37390e0c5131d53.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA111/b88371815df65e72aa766684dc316cf68d07e088.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA111/321974c802e4d58c9b66f2314ca0ffe275dcef81.png)

输入输出样例

输入样例 #1

4
4 2 3 1
1 3 2 4
3 2 1 4
2 3 4 1
10
3 1 2 4 9 5 10 6 8 7
1 2 3 4 5 6 7 8 9 10
4 7 2 3 10 6 9 1 5 8
3 1 2 4 9 5 10 6 8 7
2 10 1 3 8 4 9 5 7 6

输出样例 #1

1
2
3
6
5
10
9