https://vjudge.net/contest/262753#overview
C - Regular Number HDU - 5972
bitset
int n,a[1111][12];
char s[5000050];
int main()
{
while(~scanf("%d",&n))
{
bitset<1000> bt[11];
re(i,0,9)bt[i].reset();
re(i,1,n)
{
int x;inin(x);
re(j,1,x)
{
int y;inin(y);
bt[y][i-1]=1;
}
}
strin(s+1);
int len=strlen(s+1);
while(s[len]<'0'||s[len]>'9')len--;
bitset<1000> temp;
temp.reset();
re(i,1,len)
{
temp<<=1;
temp[0]=1;
temp&=bt[s[i]-'0'];
if(temp[n-1]==1)
{
fwrite(s+i-n+1,sizeof(s[0]),n,stdout);
puts("");
}
}
}
return 0;
}