• 262144K
 

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 xi​= xj​ and yi​ = yj​, then <xi​, yi​> <xj​, yj​> 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 , bb > is appeared in frame2,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≤T≤10) , giving the test cases.

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

In The next nn lines, each line contains one integer ki​ ( the number of features) and 2ki​ intergers describe ki​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 N will satisfy N≤100000 .

Output

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 徐州赛区网络预赛

 #define  P pair<int,int>
using namespace std;
int t,n,k;
int x,y;
map<P,int>mp[];
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
int maxx=;
mp[].clear();
mp[].clear();
int last=;
for(int i=;i<=n;i++)
{
last=-last;//滚动
scanf("%d",&k);
for(int j=;j<=k;j++)
{
scanf("%d%d",&x,&y);
if(!mp[-last].count({x,y}) ){//因为必须连续的才有效
mp[last][{x,y}]=;
}
else{
mp[last][{x,y}]=mp[-last][{x,y}]+;
}
maxx=max(maxx,mp[last][{x,y}]);
}
mp[-last].clear();//继续滚动
}
printf("%d\n",maxx);
}
return ;
}

最新文章

  1. 关于Linux和Windows下部署mysql.data.dll的注册问题
  2. iOS编程中遇到的问题
  3. IT技术学习指导之Linux系统入门的4个阶段(纯干货带图)
  4. 微信小程序之后台https域名绑定以及免费的https证书申请
  5. 一些asp.net使用
  6. FullCalendar只可以从外部拖入,内部不能互相拖动
  7. Swift基础--手势识别(双击、捏、旋转、拖动、划动、长按)
  8. Ibatis的类型处理器TypeHandler解析
  9. Javascript offsetLeft详情
  10. bigDecimal 使用小结
  11. jquery data方法取值与js attr取值的区别
  12. Springboot 使用 JSR 303 对 Controller 控制层校验及 Service 服务层 AOP 校验,使用消息资源文件对消息国际化
  13. label按钮和文字对齐
  14. 新概念英语(1-127)A famous actoress(女演员)
  15. mybatis_16逆向工程
  16. echarts绘制k线图为什么写candlestick类型就报错
  17. Java泛型知识点全方位总结
  18. bzoj 1406
  19. 【Asp.net入门3-05】处理JSON数据
  20. CGLIB动态代理模式

热门文章

  1. 《深入理解java虚拟机》笔记(7)JVM调优(分代垃圾收集器)
  2. 牛客网Java刷题知识点之什么是内部类、为什么要使用内部类、内部类如何使用外部类的属性和方法、成员内部类、局部内部类、静态内部类、匿名内部类
  3. memcache和iptables开启11211端口
  4. Fedora12下yum安装低版本gcc
  5. 简单ui
  6. 数据库迁移后报错提示MySQL Error:Can&#39;&#39;t find file errno: 13 - Permission denied的解决方法
  7. LR中变量、参数的使用介绍
  8. 【TensorFlow入门完全指南】模型篇&#183;线性回归模型
  9. 机器学习&amp;深度学习资料分享
  10. Android(java)学习笔记122:BroadcastReceiver之 有序广播和无序广播(BroadcastReceiver优先级)