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 NN will satisfy N \le 100000N≤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 徐州赛区网络预赛

题意:每一个frame中都有k个坐标

问连续出现的坐标 连续的frame最长的是多少

思路:

很简单的一个暴力 给每一个动作都编号 记下都在哪些frame中出现过

然后排个序 从头到尾跑一遍

要注意一个动作可能在同一个frame中出现

WA了超级久 初始化没有写好

看来以后还是不能在毛概课上A题


#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<set>
//#include<bits/stdc++.h>
#define inf 0x7f7f7f7f7f7f7f7f
using namespace std;
typedef long long LL; const int maxn = 1e5+ 100;
typedef pair<int, int> mpair;
map<mpair, int> mmap;
int t, n, cntid, cnt;
struct node{
int id, frame;
}feature[maxn]; bool cmp(node a, node b)
{
if(a.id == b.id){
return a.frame < b.frame;
}
else{
return a.id < b.id;
}
} void init()
{
mmap.clear();
for(int i = 0; i < maxn; i++){
feature[i].id = 0;
feature[i].frame = 0;
}
cntid = 0;
cnt = 0;
} int main()
{
cin>>t;
while(t--){
init();
scanf("%d", &n);
if(n == 0){
printf("0\n");
continue;
}
for(int i = 0; i < n; i++){
int k;
scanf("%d", &k);
for(int j = 0; j < k; j++){
int x, y;
scanf("%d%d", &x, &y);
mpair p = make_pair(x, y);
if(mmap.find(p) == mmap.end()){
mmap[p] = cntid++;
}
feature[cnt].id = mmap[p];
feature[cnt].frame = i;
cnt++;
}
} sort(feature, feature + cnt, cmp);
int ans = 1, tmp = 1;
for(int i = 0; i < cnt - 1; i++){
if(feature[i].id == feature[i + 1].id && feature[i].frame + 1 == feature[i + 1].frame){
tmp++;
}
else if(feature[i].id == feature[i + 1].id && feature[i].frame == feature[i + 1].frame){
continue;
}
else{
ans = max(ans, tmp);
tmp = 1;
}
}
ans = max(ans, tmp); printf("%d\n", ans);
}
return 0;
}

徐州网络赛F-Feature Trace【暴力】的更多相关文章

  1. 2015北京网络赛 F Couple Trees 暴力倍增

    Couple Trees Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://hihocoder.com/problemset/problem/123 ...

  2. 2018 icpc 徐州网络赛 F Features Track

    这个题,我也没想过我这样直接就过了 #include<bits/stdc++.h> using namespace std; ; typedef pair<int,int> p ...

  3. 2018 ICPC 徐州网络赛

    2018 ICPC 徐州网络赛 A. Hard to prepare 题目描述:\(n\)个数围成一个环,每个数是\(0\)~\(2^k-1\),相邻两个数的同或值不为零,问方案数. solution ...

  4. ICPC 2019 徐州网络赛

    ICPC 2019 徐州网络赛 比赛时间:2019.9.7 比赛链接:The Preliminary Contest for ICPC Asia Xuzhou 2019 赛后的经验总结 // 比赛完才 ...

  5. 计蒜客 41391.query-二维偏序+树状数组(预处理出来满足情况的gcd) (The Preliminary Contest for ICPC Asia Xuzhou 2019 I.) 2019年徐州网络赛)

    query Given a permutation pp of length nn, you are asked to answer mm queries, each query can be rep ...

  6. ACM-ICPC 2019南昌网络赛F题 Megumi With String

    ACM-ICPC 南昌网络赛F题 Megumi With String 题目描述 给一个长度为\(l\)的字符串\(S\),和关于\(x\)的\(k\)次多项式\(G[x]\).当一个字符串\(str ...

  7. [徐州网络赛]Longest subsequence

    [徐州网络赛]Longest subsequence 可以分成两个部分,前面相同,然后下一个字符比对应位置上的大. 枚举这个位置 用序列自动机进行s字符串的下标转移 注意最后一个字符 #include ...

  8. 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 F. Trig Function(切比雪夫多项式+乘法逆元)

    题目链接:哈哈哈哈哈哈 _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ 哈哈哈哈哈哈,从9月16日打了这个题之后就一直在补这道题,今天终于a了,哈哈哈哈哈哈. ...

  9. 计蒜客 17119.Trig Function-切比雪夫多项式+乘法逆元 (2017 ACM-ICPC 亚洲区(西安赛区)网络赛 F)

    哈哈哈哈哈哈哈哈哈哈哈哈,终于把这道题补出来了_(:з」∠)_ 来写题解啦. _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ _(:з」∠)_ 哈哈哈哈哈哈,从9月16日打了这 ...

  10. 沈阳网络赛 F - 上下界网络流

    "Oh, There is a bipartite graph.""Make it Fantastic." X wants to check whether a ...

随机推荐

  1. 用 #include <filename.h> 格式来引用标准库的头文件

    用 #include <filename.h> 格式来引用标准库的头文件(编译器将从 标准库目录开始搜索). #include <iostream> /* run this p ...

  2. python 模块之间相互引用

    模块层级关系: ----: |->AA.py |->BB.py |->CC.py AA.py from BB import BB class AA: def sub(self, x) ...

  3. CentOS安装Emacs文本编辑器

    我这里安装的是:emacs.24.2 下载地址:http://ftp.gnu.org/pub/gnu/emacs/emacs-24.2.tar.gz 下载文件:emacs-24.2.tar.gz 步骤 ...

  4. 【Java面试题】21 Java中的异常处理机制的简单原理和应用。

    异常指Java程序运行时(非编译)所发生的非正常情况或错误. java对异常进行了分类,不同类型的异常使用了不同的java类,所有异常的根类为java.lang.Throwable.Throwable ...

  5. Powershell 的自己主动部署

     工作中反复性的版本号移植,一天上线10几次,让我痛不欲生,频繁的操作也可能出现疲劳性失误,导致严重的生产故障.于是乎,闲暇时间.我開始研究使用powershell自己主动部署程序到Linuxse ...

  6. oracle查询一个用户下的所有表

    select table_name from all_tables where owner_name=upper('scott'); 用户名一定要大写//

  7. AI逻辑实现-取舍行为树还是状态机

    AI逻辑实现-选择行为树还是状态机? 关注AI的朋友可能会看过赖勇浩翻译的<有限状态机时代终结的10大理由> ,里面谈到了状态机的诸多弊端.同时在ppt(附上下载地址)中述说了行为树的诸多 ...

  8. Unity3d导出安卓版本

    1. 要想导出安卓版,就必须要安装安卓 SDK,这个可以去这里下载. http://developer.android.com/sdk/index.html.  当我们打开后就是看见这个了. 2.当我 ...

  9. HBase 1.3(NOSQL) 发布,性能大幅提升

        Apache HBase 1.3.0版在2017年1月中旬正式发布了,新版本支持分层数据的压缩和多个方面的性能提升,像预写日志(WAL).一个新的RPC机制,等等.HBase 1.3.0一共修 ...

  10. go-study

    package (包) 一个目录下面所有的.go文件的包名必须相同. 包名一般和目录名相同(是约定, 不是强制), 包名都小写 main包是一个特殊的包名, 在main包中, 必须包含func mai ...