计蒜客 ACM-ICPC 2018 徐州赛区网络预赛 F. Features Track

  • 2018-09-10
  • 36
  • 0

Description:

Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this, he extracts cat features in each frame. A cat feature is a two-dimension vector <x, y>. If x_i = x_j and y_i = y_j, then <x_i, y_i> <x_j, y_j> are same features.

So if cat features are moving, we can think the cat is moving. If feature <a, b> is appeared in continuous frames, it will form features movement. For example, feature <a , b > is appeared in frame 2,3,4,7,8, then it forms two features movement 2-3-4 and 7-8 .

Now given the features in each frames, the number of features may be different, Morgana wants to find the longest features movement.

Input:

First line contains one integer T(1 \le T \le 10) , giving the test cases.

Then the first line of each cases contains one integer n (number of frames),

In The next n lines, each line contains one integer k_i ( the number of features) and 2k_i intergers describe k_i features in ith frame.(The first two integers describe the first feature, the 3rd and 4th integer describe the second feature, and so on).

In each test case the sum number of features N will satisfy N \le 100000 .

Output:

For each cases, output one line with one integers represents the longest length of features movement.

Sample Input:

1
8
2 1 1 2 2
2 1 1 1 4
2 1 1 2 2
2 2 2 1 4
0
0
1 1 1
1 1 1

Sample Output:

3

题目链接

每一帧有k个动作,每个动作有两个属性,当且仅当两个属性都相同时动作相同,求动作最大连续帧数。

使用两个unordered_map(不需要有序),key为动作,value为连续帧数,两个map循环更新每一帧所有动作的连续帧数,维护最大值。

AC代码:

评论

还没有任何评论,你来说两句吧