Features Track 2018徐州icpc网络赛 思维
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_jxjand 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_i2kiintergers 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
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
题目来源
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define ls (r<<1)
#define rs (r<<1|1)
#define debug(a) cout << #a << " " << a << endl
using namespace std;
typedef long long ll;
const ll maxn = 1e5+10;
const ll mod = 2e9+7;
const double pi = acos(-1.0);
const double eps = 1e-8;
map<ll,pair<ll,ll> >mp;
map<ll,ll> mm;
int main() {
ll k, n, a, b, T;
scanf("%lld",&T);
while( T -- ) {
scanf("%lld",&n);
ll maxa = 0;
mp.clear();
for( ll i = 1; i <= n; i ++ ) {
scanf("%lld",&k);
mm.clear();
while( k -- ) {
scanf("%lld%lld",&a,&b);
ll t = a*mod + b; //通过乘mod将每个坐标转化成一个不同的值
if( mp[t].first == i-1 ) {
mp[t].second = mp[t].second + 1, mp[t].first = i;
} else if( mm[t] ) {
continue;
} else {
mp[t].second = 1, mp[t].first = i;
}
mm[t] ++;
maxa = max(maxa,mp[t].second);
}
}
if( maxa == 1 ) {
maxa = 0;
}
printf("%lld\n",maxa);
}
return 0;
}
Features Track 2018徐州icpc网络赛 思维的更多相关文章
- Trace 2018徐州icpc网络赛 思维+二分
There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy) ...
- 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 ...
- Trace 2018徐州icpc网络赛 (二分)(树状数组)
Trace There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx ...
- ICPC 2018 徐州赛区网络赛
ACM-ICPC 2018 徐州赛区网络赛 去年博客记录过这场比赛经历:该死的水题 一年过去了,不被水题卡了,但难题也没多做几道.水平微微有点长进. D. Easy Math 题意: ...
- 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 ...
- Supreme Number 2018沈阳icpc网络赛 找规律
A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying ...
- 2019 徐州icpc网络赛 E. XKC's basketball team
题库链接: https://nanti.jisuanke.com/t/41387 题目大意 给定n个数,与一个数m,求ai右边最后一个至少比ai大m的数与这个数之间有多少个数 思路 对于每一个数,利用 ...
- ACM-ICPC 2018 徐州赛区网络预赛 F. Features Track
262144K Morgana is learning computer vision, and he likes cats, too. One day he wants to find the ...
- ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心)
ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心) Trace 问答问题反馈 只看题面 35.78% 1000ms 262144K There's a beach in t ...
随机推荐
- WIN10安装VC6.0无法使用的解决办法
WIN10安装VC6.0无法使用的解决办法 VC6.0确实已经太老了 VC6.0实在是很久以前的开发工具了,现在的win10已经对该软件不兼容,但是为了能使抱着怀旧情节的初学者们能像教科书或老前辈们一 ...
- spring学习笔记之---bean管理的注解方式
bean管理的注解方式 (一)使用注解定义bean (1)常用注解 (2)实例 1.在pom.xml中进行配置 <dependencies> <dependency> < ...
- luogu1330_封锁阳光大学 图的遍历
传送门 解释:(转自洛谷题解) 首先,肯定要明确一点,那就是这个图是不一定联通的.于是,我们就可以将整张图切分成许多分开的连同子图来处理.然而最重要的事情是:如何处理一个连通图? 乍看下去,似乎无从下 ...
- java学习-NIO(三)Channel
通道(Channel)是java.nio的第二个主要创新.它们既不是一个扩展也不是一项增强,而是全新.极好的Java I/O示例,提供与I/O服务的直接连接.Channel用于在字节缓冲区和位于通道另 ...
- 微服务与网关技术(SIA-GateWay)
一.背景 软件架构,总是在不断的演进中... 把时间退回到二十年之前,当时企业级领域研发主要推崇的还是C/S模式,PB.Delphi这样的开发软件是企业应用开发的主流.随着时间的推移,基于浏览器的B/ ...
- Java——字符串
1.不可变的String String对象是不可变的.String类中的每一个看起来会修改String值的方法,实际上都是创建了一个全新的String对象,以包含修改修改后的字符串内容. public ...
- 弹性盒子---CSS3布局方式
1.弹性盒子/伸缩盒子 如果要使用弹性盒子属性,首先要将父级元素变成弹性盒子 Flex-direction 设置伸缩盒子的内部元素的排列方式 Row 从左到右安行排列 Column 从上到下按 ...
- 从MYSQL的ibtmp1文件太大说起
1. 啥情况呀 测试环境机器磁盘空间不足的告警打破了下午的沉寂,一群人开始忙活着删数据.但是,不久前刚清理了一波数据,测试环境在没做压测的情况下不至于短短一个月不到就涨了200G数据,于是,我悄悄的 ...
- java中String,StringBuffer,StringBuilder的区别
String: 1,是字符串常量,一旦创建就不能修改.对于已经存在了的String对象的修改都是重新创建一个新的对象,然后把新的值保存进去. 2,String也是final类,不能被继承. 3,而且S ...
- Tomcat源码分析 (七)----- Tomcat 启动过程(二)
在上一篇文章中,我们分析了tomcat的初始化过程,是由Bootstrap反射调用Catalina的load方法完成tomcat的初始化,包括server.xml的解析.实例化各大组件.初始化组件等逻 ...