zoukankan      html  css  js  c++  java
  • ACM-ICPC 2018 徐州赛区网络预赛 F. Features Track

    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 徐州赛区网络预赛

    #include<iostream>
    #include<map>
    #include<queue>
    #include<stack>
    #include<cstring>
    #include<algorithm>
    using namespace std;
    
    pair<int,int>a;
    map< pair<int,int> , pair<int,int> >mp;
    
    int main()
    {
    	int n,m,j,k,i,T,a,b;
    	cin>>T;
    	while (T--)
    	{
    		cin>>n;
    		int ans=-1;
    		for (i=1;i<=n;i++)
    		{
    			cin>>k;
    			for (j=1;j<=k;j++)
    			{
    				cin>>a>>b;
    				if (mp[pair<int,int>(a,b)].second ==i-1 )
    				mp[pair<int,int>(a,b)].first++;
    				else if (mp[pair<int,int>(a,b)].second ==i)
    				continue;
    				else
    				mp[pair<int,int>(a,b)].first = 1;
    				
    				ans = max(ans,mp[pair<int,int>(a,b)].first);
    				mp[pair<int,int>(a,b)].second = i;
    			}
    		}
    		cout<<ans<<endl;
    	}
    	return 0;	
    }
    
    
    
  • 相关阅读:
    OpenCASCADE 平面与球面求交
    OpenCASCADE 平面求交
    为 Taro 的小程序 TS 模板加点料
    async-validator 的中文文档翻译
    JS中的与冒号的作用、箭头函数相关的一道题
    为Electron 安装 vue-devtool等扩展
    小程序做一个能够左右滑动切换的多tab页面
    使用sourceMap文件定位小程序错误信息
    手写一个promise
    通过页面预加载(preload)提升小程序的响应速度
  • 原文地址:https://www.cnblogs.com/Romantic-Chopin/p/12451425.html
Copyright © 2011-2022 走看看