Submission #682705

# Submission time Handle Problem Language Result Execution time Memory
682705 2023-01-16T20:11:03 Z Lobo Political Development (BOI17_politicaldevelopment) C++17
0 / 100
1293 ms 524288 KB
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 5e4+10;
int n, k, fq[maxn];
vector<int> g[maxn];
map<int,int> ed[maxn];
 
void solve() {
    cin >> n >> k;
    for(int i = 0; i < n; i++) {
        int d; cin >> d;
        while(d--) {
            int x; cin >> x;
            ed[i][x] = 1;
            g[i].pb(x);
        }
    }
 
    for(int i = 0; i < n; i++) {
        for(auto j : g[i]) {
            for(auto l : g[j]) {
                if(ed[i][l]) {
                    cout << 3 << endl;
                    return;
                }
            }
        }
    }
 
    for(int i = 0; i < n; i++) {
        if(g[i].size()) {
            cout << 2 << endl;
            return;
        }
    }
 
    cout << 1 << endl;
 
 
}
 
int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0);
 
    // freopen("in.in", "r", stdin);
    // freopen("out.out", "w", stdout);
    int tt = 1;
    // cin >> tt;
    while(tt--) {
        solve();
    }
 
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3796 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 8 ms 6100 KB Output is correct
4 Runtime error 1293 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3796 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 8 ms 6100 KB Output is correct
4 Runtime error 1293 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3796 KB Output is correct
2 Correct 3 ms 3800 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
4 Correct 2 ms 3844 KB Output is correct
5 Incorrect 2 ms 3796 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3796 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 8 ms 6100 KB Output is correct
4 Runtime error 1293 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3796 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 8 ms 6100 KB Output is correct
4 Runtime error 1293 ms 524288 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -