85分求助
查看原帖
85分求助
690669
Beacon_wolf楼主2024/10/13 16:14
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,a[1010][1010];
bool sfy[1010];
int main(){
	int anss = 0;
	cin >> n >> m;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= m;j++){
			cin >> a[i][j];
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++) sfy[j] = false;
		bool ok = true; 
		int k;
		cin >> k;
		for(int j = 1;j <= k;j++){
			int l;
			cin >> l;
			sfy[l] = true;
		}
		for(int j = 1;j <= m;j++){
			if(!sfy[a[i][j]]){
				ok = false;
				break;
			}
		}
		if(ok) anss += 2;
	}
	cout << anss << endl; 
	return 0;
} 
2024/10/13 16:14
加载中...