比赛 |
至少完成十道练习 |
评测结果 |
AAAAAAAAAAAAATTTTTTA |
题目名称 |
海港 |
最终得分 |
70 |
用户昵称 |
皓芷 |
运行时间 |
6.032 s |
代码语言 |
C++ |
内存使用 |
2.67 MiB |
提交时间 |
2017-05-23 19:00:45 |
显示代码纯文本
#include<cstdio>
#include<iostream>
#include<vector>
#define mysister
#define maxn 86400
using namespace std;
int n,before=1,to[maxn],from[maxn],now=0,t[100001],k,g[maxn],x;
vector<int>ship[maxn];
int main()
{
freopen("port.in","r",stdin);
freopen("port.out","w",stdout);
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d%d",&t[i],&k);
while(t[i]-maxn>=t[before])
{
for(int j=1;j<=ship[before][0];j++)
{
g[ship[before][j]]--;
if(g[ship[before][j]]==0){to[from[ship[before][j]]]=to[ship[before][j]];from[to[ship[before][j]]]=from[ship[before][j]];}
}
before++;
}
ship[i].push_back(k);
for(int j=1;j<=k;j++)
{
scanf("%d",&x);
ship[i].push_back(x);
if(g[x]==0){to[now]=x;from[x]=now;now=x;}
g[x]++;
}
int cf=0,ans=0;
while(to[cf]!=0)
{
ans++;
cf=to[cf];
}
printf("%d\n",ans);
}
return 0;
}