PKU 2664 Prerequisites?

http://poj.org/problem?id=2664
Freddieが取らないといけない科目のリストのようなものが与えられるので、Freddieが取得した科目が条件を満たしているかを判定するような問題。

普通に書いたらTLEった。
オプション付けて通しました。PKU先生ひどい。

main(){
  ios::sync_with_stdio(false);
  int k,m;
  while(cin>>k,k){
    cin>>m;
    set<int> fle;
    rep(i,k){
      int t;
      cin>>t;
      fle.insert(t);
    }

    bool ok=true;
    rep(i,m){
      int c,r;
      cin>>c>>r;
      int take=0;
      rep(j,c){
	int t;
	cin>>t;
	if(fle.count(t))++take;
      }
      if(take<r)ok=false;
    }
    if(ok)cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
}