呜呜呜,70分,其他都超时
查看原帖
呜呜呜,70分,其他都超时
659308
aa9527楼主2022/7/16 19:02
#include<iostream>
#include<map>
using namespace std;
struct people
{
	int no;
	int time;
	int nature;
};
people p[300001];
int result[300001];
int main()
{
	int n=0;
	cin>>n;
	map<int,int>map_;
	int m=1;
	for(int i=1;i<=n;i++)
	{
		int t=0;
		int k=0;
		cin>>t>>k;
		for(int j=1;j<=k;j++)
		{
			int x=0;
			cin>>x;
			p[m].no=i;		//该人所在的船号 
			p[m].time=t;	//该人所在船的到达时间 
			p[m].nature=x;	//该人的国籍 
			m++;
		}
		int s=1;			//船的序号 
		int flag=0;
		while(s<=i)
		{
			for(int j=flag+1;p[j].no<=i && p[j].no>0;j++)
			{
				if(p[m-1].time-p[j].time>=86400)
				{
					flag=j;
					continue;
				} 
				else
				{
					map_[p[j].nature]++;
				}
			}
			result[i]=map_.size();
			map_.clear();
			s++;
		}
	}
	for(int i=1;i<=n;i++)
	{
		cout<<result[i]<<endl;
	}
} 
2022/7/16 19:02
加载中...