#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define all(a) a.begin(),a.end()
#define v vector
#define pb push_back
int main(){ios_base::sync_with_stdio(0);cin.tie(0);
int n, s, x, wyn=0, pom;
v<int>wyst;
cin >> n >> wyn;
pom=wyn;
for(int i=1;i<n;i++){
cin >> s;
wyst.resize(pom,0);
for(int j=0;j<s;j++){
cin >> x;
if(x) wyst[x-1]++;
if(wyst[x-1]>1) wyn++;
}
wyn=max(wyn,s);
wyst.clear();
pom=s;
}
cout << wyn;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <bits/stdc++.h> using namespace std; #define LL long long #define all(a) a.begin(),a.end() #define v vector #define pb push_back int main(){ios_base::sync_with_stdio(0);cin.tie(0); int n, s, x, wyn=0, pom; v<int>wyst; cin >> n >> wyn; pom=wyn; for(int i=1;i<n;i++){ cin >> s; wyst.resize(pom,0); for(int j=0;j<s;j++){ cin >> x; if(x) wyst[x-1]++; if(wyst[x-1]>1) wyn++; } wyn=max(wyn,s); wyst.clear(); pom=s; } cout << wyn; return 0; } |
English