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 <xx, yy>. If x_ixi​ = x_jxj​and y_iyi​ = y_jyj​, then <x_ixi​, y_iyi​> <x_jxj​, y_jyj​> are same features.

So if cat features are moving, we can think the cat is moving. If feature <aa, bb> is appeared in continuous frames, it will form features movement. For example, feature <aa , bb > is appeared in frame 2,3,4,7,82,3,4,7,8, then it forms two features movement 2-3-42−3−4 and 7-87−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)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 NNwill satisfy N \le 100000N≤100000 .

Output

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

样例输入复制

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

样例输出复制

  1. 3

题目来源

ACM-ICPC 2018 徐州赛区网络预赛

 
 
题意:n个集合,每个集合有ki个点,问连续在多个集合中出现的次数最多的点的次数
分析:用一个map存下每个点的最后一次出现位置和连续出现次数,连续出现次数通过最后一次出现位置来判断,每次更新连续出现次数时取下最大值
AC代码:
  1. #include <map>
  2. #include <set>
  3. #include <stack>
  4. #include <cmath>
  5. #include <queue>
  6. #include <cstdio>
  7. #include <vector>
  8. #include <string>
  9. #include <bitset>
  10. #include <cstring>
  11. #include <iomanip>
  12. #include <iostream>
  13. #include <algorithm>
  14. #define ls (r<<1)
  15. #define rs (r<<1|1)
  16. #define debug(a) cout << #a << " " << a << endl
  17. using namespace std;
  18. typedef long long ll;
  19. const ll maxn = 1e5+10;
  20. const ll mod = 2e9+7;
  21. const double pi = acos(-1.0);
  22. const double eps = 1e-8;
  23. map<ll,pair<ll,ll> >mp;
  24. map<ll,ll> mm;
  25. int main() {
  26. ll k, n, a, b, T;
  27. scanf("%lld",&T);
  28. while( T -- ) {
  29. scanf("%lld",&n);
  30. ll maxa = 0;
  31. mp.clear();
  32. for( ll i = 1; i <= n; i ++ ) {
  33. scanf("%lld",&k);
  34. mm.clear();
  35. while( k -- ) {
  36. scanf("%lld%lld",&a,&b);
  37. ll t = a*mod + b; //通过乘mod将每个坐标转化成一个不同的值
  38. if( mp[t].first == i-1 ) {
  39. mp[t].second = mp[t].second + 1, mp[t].first = i;
  40. } else if( mm[t] ) {
  41. continue;
  42. } else {
  43. mp[t].second = 1, mp[t].first = i;
  44. }
  45. mm[t] ++;
  46. maxa = max(maxa,mp[t].second);
  47. }
  48. }
  49. if( maxa == 1 ) {
  50. maxa = 0;
  51. }
  52. printf("%lld\n",maxa);
  53. }
  54. return 0;
  55. }

  

Features Track 2018徐州icpc网络赛 思维的更多相关文章

  1. Trace 2018徐州icpc网络赛 思维+二分

    There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy) ...

  2. Ryuji doesn't want to study 2018徐州icpc网络赛 树状数组

    Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, ea ...

  3. Trace 2018徐州icpc网络赛 (二分)(树状数组)

    Trace There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx ...

  4. ICPC 2018 徐州赛区网络赛

    ACM-ICPC 2018 徐州赛区网络赛  去年博客记录过这场比赛经历:该死的水题  一年过去了,不被水题卡了,但难题也没多做几道.水平微微有点长进.     D. Easy Math 题意:   ...

  5. ACM-ICPC 2018 徐州赛区(网络赛)

    目录 A. Hard to prepare B.BE, GE or NE F.Features Track G.Trace H.Ryuji doesn't want to study I.Charac ...

  6. Supreme Number 2018沈阳icpc网络赛 找规律

    A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying ...

  7. 2019 徐州icpc网络赛 E. XKC's basketball team

    题库链接: https://nanti.jisuanke.com/t/41387 题目大意 给定n个数,与一个数m,求ai右边最后一个至少比ai大m的数与这个数之间有多少个数 思路 对于每一个数,利用 ...

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

    262144K   Morgana is learning computer vision, and he likes cats, too. One day he wants to find the ...

  9. ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心)

    ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心) Trace 问答问题反馈 只看题面 35.78% 1000ms 262144K There's a beach in t ...

随机推荐

  1. 精准营销、批量提取QQ群成员号码

    有时我们在做精准营销时,需要从社群里提取群成员的QQ号,群发邮件,常规的做法是手工一个个复制粘贴,这样的效率无疑是很低的,下面我来分享一个批量获取社群的QQ号方法. 需要具备以下工具: 1.大量精准Q ...

  2. File signature analysis fails to recognize .old file

    My friend May she found a strange file called "bkp.old" as below in the evidence files. Sh ...

  3. S2:c#继承

    在C#中,如果一个类后面通过冒号又跟了另外一个类,那么我们就称冒号前面的类为子类,冒号后面的类为父类.这种书写类的方式放映出来的关系就称为类的继承关系. 1.子类:派生类 父类:基类或者超类 满足is ...

  4. 《HTTP权威指南》--阅读笔记(二)

    URL的三部分: 1,方案 scheme 2,服务器位置 3,资源路径 URL语法: <scheme>://<user>:<password>@<host&g ...

  5. 10分钟安装Elasticsearch

    关注公众号 itweknow,回复"ES"获取<Elasticsearch权威指南 中文版>. 最近在尝试着搭建一个ELK(一个开源的实时日志分析平台),而本文所讲的E ...

  6. 【0812 | Day 13】闭包函数/装饰器/迭代器

    目录 闭包函数 无参装饰器 有参装饰器 迭代器 闭包函数 一.什么是闭包? 闭包指的是:函数内部函数对外部作用域而非全局作用域的引用. def outter(): x = 1 def inner(): ...

  7. SimpleDateFormat线程不安全问题解决及替换方法

    场景:在多线程情况下为避免多次创建SimpleDateForma实力占用资源,将SimpleDateForma对象设置为static. 出现错误:SimpleDateFormat定义为静态变量,那么多 ...

  8. Springboot源码分析之项目结构

    Springboot源码分析之项目结构 摘要: 无论是从IDEA还是其他的SDS开发工具亦或是https://start.spring.io/ 进行解压,我们都会得到同样的一个pom.xml文件 4. ...

  9. vue生成element左侧菜单

    首先来总结element ui 官方文档的左侧菜单结构,带有el-submenu为子级节点,el-menu-item表示没有下级.当然,菜单不能写死,因为菜单也许不止两级,所以我们需要递归来实现.根据 ...

  10. 吉特日化MES-工业生产盲区

    工业生产的几大盲区 1  重硬件忽略软件 : 目前只要提到智能化,大家都是想到的是一大堆自动执行的设备,什么机器人,输送线,人脸识别摄像头等,在一成套的系统中可能硬件几百万上千万,软件可以是几万几千几 ...