//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ve vector
typedef long long ll;
const int MAXN = 5000;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, k, d, a;
bool r2, r3;
vector<bitset<MAXN>> G;
cin >> n >> k;
G = vector<bitset<MAXN>>(n);
r2 = false;
for (int i = 0; i < n; i++) {
cin >> d;
for (int j = 0; j < d; j++) {
cin >> a;
G[i].set(a);
r2 = true;
}
}
r3 = false;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if ((G[i] & G[j]).any()) {
r3 = true;
}
}
}
if (r3) cout << 3 << endl;
else if (r2) cout << 2 << endl;
else cout << 1 << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3084 ms |
3456 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |