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 <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 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 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
题目来源
#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 ;
}
ACM-ICPC 2018 徐州赛区网络预赛 F. Features Track的更多相关文章
- ACM-ICPC 2018 徐州赛区网络预赛 F Features Track(STL模拟)
https://nanti.jisuanke.com/t/31458 题意 有N个帧,每帧有K个动作特征,每个特征用一个向量表示(x,y).两个特征相同当且仅当他们在不同的帧中出现且向量的两个分量分别 ...
- 计蒜客 31458.Features Track-滚动数组+STL(map)连续计数 (ACM-ICPC 2018 徐州赛区网络预赛 F)
F. Features Track Morgana is learning computer vision, and he likes cats, too. One day he wants to f ...
- ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer (最大生成树+LCA求节点距离)
ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer J. Maze Designer After the long vacation, the maze designer ...
- ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心)
ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心) Trace 问答问题反馈 只看题面 35.78% 1000ms 262144K There's a beach in t ...
- ACM-ICPC 2018 徐州赛区网络预赛(8/11)
ACM-ICPC 2018 徐州赛区网络预赛 A.Hard to prepare 枚举第一个选的,接下来的那个不能取前一个的取反 \(DP[i][0]\)表示选和第一个相同的 \(DP[i][1]\) ...
- 计蒜客 1460.Ryuji doesn't want to study-树状数组 or 线段树 (ACM-ICPC 2018 徐州赛区网络预赛 H)
H.Ryuji doesn't want to study 27.34% 1000ms 262144K Ryuji is not a good student, and he doesn't wa ...
- ACM-ICPC 2018 徐州赛区网络预赛 B(dp || 博弈(未完成)
传送门 题面: In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl n ...
- ACM-ICPC 2018 徐州赛区网络预赛 B. BE, GE or NE
In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named &qu ...
- ACM-ICPC 2018 徐州赛区网络预赛 H. Ryuji doesn't want to study
262144K Ryuji is not a good student, and he doesn't want to study. But there are n books he should ...
随机推荐
- HDU 2243 考研路茫茫——单词情结 求长度小于等于L的通路总数的方法
http://acm.hdu.edu.cn/showproblem.php?pid=2243 这是一题AC自动机 + 矩阵快速幂的题目, 首先知道总答案应该是26^1 + 26^2 + 26^3 .. ...
- 博弈论 && 题目
终于我也开始学博弈了,说了几个月,现在才学.学多点套路,不深学.(~~) 参考刘汝佳蓝书p132 nim游戏: 假设是两维的取石子游戏,每次可以在任意一堆拿任意数量个(至少一根,因为这样游戏的状态集有 ...
- Python踩坑之旅其二裸用os.system的原罪
目录 1.1 踩坑案例 1.2 填坑解法 1.3 坑位分析 1.4.1 技术关键字 1.5 填坑总结 2. 前坑回顾 2.1 Linux中, 子进程拷贝父进程哪些信息 2.2 Agent常驻进程选择& ...
- 洪水 Pow
Description AKD市处在一个四面环山的谷地里.最近一场大暴雨引发了洪水,AKD市全被水淹没了.Blue Mary,AKD市的市长,召集了他的所有顾问(包括你)参加一个紧急会议.经过细致的商 ...
- springboot集成shiro实现权限认证
github:https://github.com/peterowang/shiro 基于上一篇:springboot集成shiro实现身份认证 1.加入UserController package ...
- MVC与Holla聊天工具
MVC 是一种设计模式, 它将应用划分为 3 个部分 : 数据( 模型). 展现层( 视图) 和用 户交互层( 控制器). 换句话说, 一个事件的发生是这样的过程 : 1. 用户和应用产生交互. 2. ...
- 一键部署WordPress开源内容管理系统
https://market.azure.cn/Vhd/Show?vhdId=9857&version=10889 产品详情 产品介绍WordPress是一款个人博客系统,并逐步演化成一款内容 ...
- redis自启动配置详解
一.概述 1.1原理 redis自启动的工作原理是怎么样的呢?Linux系统启动后,会有一个程序去特定目录下面扫描文件,然后执行这些文件,这些文件可称之为脚本.所以,你可以把你的工作写成一个脚本,放到 ...
- 使用github进行代码托管
---恢复内容开始--- 记录下使用github进行个人代码托管,github是公共的代码托管库,可以免费使用,由于是公共的所以大家都可以查看,如果是隐私重要的文件代码可以选择付费变为私有库 1.注册 ...
- 自定义标签jsp2格式
在写自定义标签时候是不是感觉很烦啊,其实人家也是这样认为的,于是我们的jsp新的标准对标签进行了更改,使我们用起来更简单.到底哪里简单呢?看看代码再说咯: 还是老规矩,先上一个标签的逻辑类: 1. p ...