当前位置: 首页 > news >正文

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

  •  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 <xy>. If xixj and yi = yj, then <xiyi> <xjyj> are same features.

So if cat features are moving, we can think the cat is moving. If feature <ab> 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 234 and 78 .

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(1T10) , 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 kifeatures 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 N100000 .

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

 

 

 1 #define  P pair<int,int>
 2 using namespace std;
 3 int t,n,k;
 4 int x,y;
 5 map<P,int>mp[2];
 6 int  main()
 7 {
 8     scanf("%d",&t);
 9     while(t--)
10     {
11         scanf("%d",&n);
12         int maxx=0;
13         mp[0].clear();
14         mp[1].clear();
15         int last=0;
16         for(int  i=1;i<=n;i++)
17         {
18             last=1-last;//滚动
19             scanf("%d",&k);
20             for(int  j=1;j<=k;j++)
21             {
22                 scanf("%d%d",&x,&y);
23                 if(!mp[1-last].count({x,y}) ){//因为必须连续的才有效
24                     mp[last][{x,y}]=1;
25                     }
26                     else{
27                         mp[last][{x,y}]=mp[1-last][{x,y}]+1;
28                     }
29                     maxx=max(maxx,mp[last][{x,y}]);
30             }
31             mp[1-last].clear();//继续滚动
32         }
33         printf("%d\n",maxx);
34     }
35     return   0;
36 }

 

转载于:https://www.cnblogs.com/tingtin/p/9614646.html

相关文章:

  • html一周小结
  • 4位先行进位电路 logisim_数字集成电路的自动化设计作业—1
  • CodeForces149D dfs实现区间dp
  • 内容可编辑_新标准化煤矿安全生产理念内容(最全)
  • python之基础知识-字符串和编码
  • c++ 与windows服务的通讯_Windows操作系统之不带引号的服务路径提权
  • 10.Spring——框架的AOP
  • 为什么自动关闭_为什么老司机一上车就关掉这个功能?
  • ubuntu安装logisim_Ubuntu server 16.04安装网卡驱动方法
  • 二、C到C++的升级
  • 腐蚀rust研究台抽奖_福世蓝无化学品循环水处理系统 --- 用来控制污垢和腐蚀
  • bat配置JDK环境变量
  • ppt如何旋转流程图_稳准狠!这四款PPT插件的炫酷技能我先抱走了
  • 正确停止线程的方式三 使用Thread类中的内置的中断标记位-----------不熟悉
  • python numpy常用操作_Python numpy的基本操作你一般人都不会
  • JavaScript-如何实现克隆(clone)函数
  • [ JavaScript ] 数据结构与算法 —— 链表
  • AngularJS指令开发(1)——参数详解
  • Gradle 5.0 正式版发布
  • JavaScript 是如何工作的:WebRTC 和对等网络的机制!
  • JavaScript设计模式系列一:工厂模式
  • leetcode讲解--894. All Possible Full Binary Trees
  • redis学习笔记(三):列表、集合、有序集合
  • spring boot 整合mybatis 无法输出sql的问题
  • Vue源码解析(二)Vue的双向绑定讲解及实现
  • 基于组件的设计工作流与界面抽象
  • 算法-插入排序
  • 微信支付JSAPI,实测!终极方案
  • 正则学习笔记
  • shell使用lftp连接ftp和sftp,并可以指定私钥
  • Spring Batch JSON 支持
  • Spring第一个helloWorld
  • 基于django的视频点播网站开发-step3-注册登录功能 ...
  • 正则表达式-基础知识Review
  • # MySQL server 层和存储引擎层是怎么交互数据的?
  • #QT(智能家居界面-界面切换)
  • #Z2294. 打印树的直径
  • (04)odoo视图操作
  • (bean配置类的注解开发)学习Spring的第十三天
  • (ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY)讲解
  • (翻译)Quartz官方教程——第一课:Quartz入门
  • (淘宝无限适配)手机端rem布局详解(转载非原创)
  • *++p:p先自+,然后*p,最终为3 ++*p:先*p,即arr[0]=1,然后再++,最终为2 *p++:值为arr[0],即1,该语句执行完毕后,p指向arr[1]
  • .naturalWidth 和naturalHeight属性,
  • .NET 4 并行(多核)“.NET研究”编程系列之二 从Task开始
  • .net core 依赖注入的基本用发
  • .NET 动态调用WebService + WSE + UsernameToken
  • .net 使用ajax控件后如何调用前端脚本
  • .net打印*三角形
  • .net网站发布-允许更新此预编译站点
  • /usr/lib/mysql/plugin权限_给数据库增加密码策略遇到的权限问题
  • @DependsOn:解析 Spring 中的依赖关系之艺术
  • @javax.ws.rs Webservice注解
  • [100天算法】-x 的平方根(day 61)
  • [Android]使用Android打包Unity工程