80 pts求助
查看原帖
80 pts求助
592684
Jasoncwx楼主2023/9/18 20:52
//By Jasoncwx
#include<bits/stdc++.h>
#define R register
#define us unsigned
#define ll long long
inline ll read(){R ll s=0,w=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')w=-1;c=getchar();}while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}return s*w;}
inline void print(ll x){if(x<0){putchar('-');x=-x;}if(x>=10)print(x/10);putchar(x%10+'0');return;}
int return_0(){int ans=0;for(int i=1;i<=100000;i++){for(int j=1;j<=1e9;j++)break;for(int j=1;j<=1e5;j++){ans+=j;if(j<1e6){ans=0;break;}}if(i>1e6)ans++;}return ans;}
using namespace std;
int sum;
int a[5005][5005];
map<int,bool>mp;
int main(){
	int n=read();
	mp[1]=true;
	for(int i=1;i<=n;i++){
		a[i][0]=read();
		for(int j=1;j<=a[i][0];j++)a[i][j]=read();
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=a[i][0];j++){
			if(mp[i])mp[a[i][j]]=true;
		}
	}
	for(int i=1;i<=10000;i++)sum+=mp[i];
	cout<<sum;
	return return_0();
}
/*
5
2 2 3
1 4
0
1 5
0
*/

https://www.luogu.com.cn/record/124812610

2023/9/18 20:52
加载中...