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 ...
随机推荐
- python实现批量远程执行命令及批量上传下载文件
#!/usr/bin/env python # -*- coding: utf- -*- # @Time : // : # @Author : xuxuedong # @Site : # @File ...
- 【踩坑】Nginx上配置ssl证书实现https访问
昨天开始为域名挂上ssl证书,使得可以以https去访问服务器.按照网上所介绍的配置Nginx,然而一直访问不了网站. 第二天排查了一早上,发现不单要配置Nginx,阿里云上安全组要开启443端口,并 ...
- 一条shell统计代码行数
Xcode统计代码,用shell命令即可,非常简单.打开终端,进入你的工程目录,执行下列代码 find . -name "*.m" -or -name "*.h" ...
- css中伪类/伪元素详解
一.伪类和伪元素 伪类和伪元素都是用来修饰不在文档树中的部分,区别在于, 伪类用于当已有元素处于的某个状态时,为其添加对应的样式,这个状态是根据用户行为而动态变化的(如:hover/:active). ...
- UIWebView全解
是iOS内置的浏览器控件,可以浏览网页.打开文档等 能够加载html/htm.pdf.docx.txt等格式的文件 系统自带的Safari浏览器就是通过UIWebView实现的 MIME的英文全称是“ ...
- Jenkins中启动从节点时,出现问题如何解决,问题:No Known Hosts...
Jenkins中,启动从节点时,出现如下问题如何解决:/root/.ssh/known_hosts [SSH] No Known Hosts file was found at /root/.ssh/ ...
- 运行JavaWeb项目报错Access denied for user 'root'@'localhost' (using password: YES)
问题重现:(以下讨论范围仅限Windows环境): C:\AppServ\MySQL> mysql -u root -p Enter password: ERROR 1045 (28000): ...
- jsp另外五大内置对象之response-操作cookie
responseo3.jsp <%@ page language="java" contentType="text/html; charset=utf-8" ...
- win10 ,本地连接无法识别网络 ,无线正常,
win10 ,本地连接无法识别网络 ,无线正常, 电脑诊断是:“此计算机上缺少一个或者多个网络协议” 1.手动设置ip 失败 2.网卡卸载驱动 ...
- MovieReview—Ghost in the Shell(攻壳机动队:笑脸男事件,个别的11人事件)
AI with Wisdom I have recently watched two films in the series of Ghost in the Shell, Smilin ...