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
So if cat features are moving, we can think the cat is moving. If feature
Now given the features in each frames, the number of features may be different, Morgana wants to find the longest features movement.
First line contains one integer T(1 \le T \le 10)T(1≤T≤10), giving the test cases.
Then the first line of each cases contains one integer nn (number of frames),
In The next nn lines, each line contains one integer k_iki? ( the number of features) and 2k_i2ki?intergers describe k_iki? features in ith frame.(The first two integers describe the first feature, the 33rd and 44th integer describe the second feature, and so on).
In each test case the sum number of features NN will satisfy N \le 100000N≤100000 .
For each cases, output one line with one integers represents the longest length of features movement.
样例输入复制
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
样例输出复制
3
题目来源
ACM-ICPC 2018 徐州赛区网络预赛
#include
using namespace std;
struct haha{
int x;
mapww;
}we[100010];
char b[1000];
int main(){
int t;
scanf("%d",&t);
we[0].x=0;
while(t--){
int n;
scanf("%d",&n);
long long a;
int b,c;
int mmax=0;
for(int i=1;i<=n;i++){
we[i].ww.clear();
scanf("%d",&we[i].x);
for(int j=1;j<=we[i].x;j++){
scanf("%d %d",&b,&c);
a=b*1000000000+c;
if(we[i-1].x==0){
we[i].ww[a]=1;
}
else{
if(we[i-1].ww[a]){
we[i].ww[a]=we[i-1].ww[a]+1;
mmax=max(mmax,we[i].ww[a]);
}
else{
we[i].ww[a]=1;
}
}
}
}
printf("%d\n",mmax);
}
}