Submission #682692

# Submission time Handle Problem Language Result Execution time Memory
682692 2023-01-16T19:13:04 Z Lobo Political Development (BOI17_politicaldevelopment) C++17
16 / 100
35 ms 7532 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];

void solve() {
    cin >> n >> k;
    for(int i = 0; i < n; i++) {
        int d; cin >> d;
        while(d--) {
            int x; cin >> x;
            g[i].pb(x);
        }
    }

    for(int i = 0; i < n; i++) {
        for(auto j : g[i]) {
            fq[j] = 1;
        }
        for(auto j : g[i]) {
            for(auto l : g[j]) {
                if(fq[l]) {
                    cout << 3 << endl;
                    return;
                }
            }
        }
        for(auto j : g[i]) {
            fq[j] = 0;
        }
    }

    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 1 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 4 ms 1620 KB Output is correct
4 Correct 16 ms 1744 KB Output is correct
5 Correct 15 ms 1708 KB Output is correct
6 Correct 2 ms 1748 KB Output is correct
7 Correct 3 ms 1748 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 4 ms 1620 KB Output is correct
4 Correct 16 ms 1744 KB Output is correct
5 Correct 15 ms 1708 KB Output is correct
6 Correct 2 ms 1748 KB Output is correct
7 Correct 3 ms 1748 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 14 ms 1744 KB Output is correct
12 Correct 17 ms 1752 KB Output is correct
13 Correct 1 ms 1432 KB Output is correct
14 Correct 20 ms 1776 KB Output is correct
15 Correct 1 ms 1492 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 1 ms 1492 KB Output is correct
18 Correct 3 ms 1748 KB Output is correct
19 Correct 1 ms 1492 KB Output is correct
20 Correct 2 ms 1644 KB Output is correct
21 Correct 2 ms 1700 KB Output is correct
22 Correct 1 ms 1508 KB Output is correct
23 Correct 3 ms 1752 KB Output is correct
24 Correct 2 ms 1492 KB Output is correct
25 Correct 3 ms 1752 KB Output is correct
26 Correct 3 ms 1752 KB Output is correct
27 Correct 2 ms 1748 KB Output is correct
28 Correct 4 ms 1772 KB Output is correct
29 Correct 3 ms 1748 KB Output is correct
30 Correct 6 ms 1768 KB Output is correct
31 Correct 3 ms 1724 KB Output is correct
32 Correct 6 ms 1748 KB Output is correct
33 Correct 3 ms 1768 KB Output is correct
34 Correct 3 ms 1748 KB Output is correct
35 Correct 2 ms 1620 KB Output is correct
36 Correct 2 ms 1620 KB Output is correct
37 Correct 2 ms 1620 KB Output is correct
38 Correct 2 ms 1492 KB Output is correct
39 Correct 2 ms 1544 KB Output is correct
40 Correct 4 ms 1900 KB Output is correct
41 Correct 2 ms 1516 KB Output is correct
42 Correct 4 ms 1876 KB Output is correct
43 Correct 3 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 1 ms 1504 KB Output is correct
4 Correct 1 ms 1492 KB Output is correct
5 Incorrect 1 ms 1432 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 4 ms 1620 KB Output is correct
4 Correct 16 ms 1744 KB Output is correct
5 Correct 15 ms 1708 KB Output is correct
6 Correct 2 ms 1748 KB Output is correct
7 Correct 3 ms 1748 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 14 ms 1744 KB Output is correct
12 Correct 17 ms 1752 KB Output is correct
13 Correct 1 ms 1432 KB Output is correct
14 Correct 20 ms 1776 KB Output is correct
15 Correct 1 ms 1492 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 1 ms 1492 KB Output is correct
18 Correct 3 ms 1748 KB Output is correct
19 Correct 1 ms 1492 KB Output is correct
20 Correct 2 ms 1644 KB Output is correct
21 Correct 2 ms 1700 KB Output is correct
22 Correct 1 ms 1508 KB Output is correct
23 Correct 3 ms 1752 KB Output is correct
24 Correct 2 ms 1492 KB Output is correct
25 Correct 3 ms 1752 KB Output is correct
26 Correct 3 ms 1752 KB Output is correct
27 Correct 2 ms 1748 KB Output is correct
28 Correct 4 ms 1772 KB Output is correct
29 Correct 3 ms 1748 KB Output is correct
30 Correct 6 ms 1768 KB Output is correct
31 Correct 3 ms 1724 KB Output is correct
32 Correct 6 ms 1748 KB Output is correct
33 Correct 3 ms 1768 KB Output is correct
34 Correct 3 ms 1748 KB Output is correct
35 Correct 2 ms 1620 KB Output is correct
36 Correct 2 ms 1620 KB Output is correct
37 Correct 2 ms 1620 KB Output is correct
38 Correct 2 ms 1492 KB Output is correct
39 Correct 2 ms 1544 KB Output is correct
40 Correct 4 ms 1900 KB Output is correct
41 Correct 2 ms 1516 KB Output is correct
42 Correct 4 ms 1876 KB Output is correct
43 Correct 3 ms 1876 KB Output is correct
44 Incorrect 6 ms 2004 KB Output isn't correct
45 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1492 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 4 ms 1620 KB Output is correct
4 Correct 16 ms 1744 KB Output is correct
5 Correct 15 ms 1708 KB Output is correct
6 Correct 2 ms 1748 KB Output is correct
7 Correct 3 ms 1748 KB Output is correct
8 Correct 1 ms 1492 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 1 ms 1492 KB Output is correct
11 Correct 14 ms 1744 KB Output is correct
12 Correct 17 ms 1752 KB Output is correct
13 Correct 1 ms 1432 KB Output is correct
14 Correct 20 ms 1776 KB Output is correct
15 Correct 1 ms 1492 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 1 ms 1492 KB Output is correct
18 Correct 3 ms 1748 KB Output is correct
19 Correct 1 ms 1492 KB Output is correct
20 Correct 2 ms 1644 KB Output is correct
21 Correct 2 ms 1700 KB Output is correct
22 Correct 1 ms 1508 KB Output is correct
23 Correct 3 ms 1752 KB Output is correct
24 Correct 2 ms 1492 KB Output is correct
25 Correct 3 ms 1752 KB Output is correct
26 Correct 3 ms 1752 KB Output is correct
27 Correct 2 ms 1748 KB Output is correct
28 Correct 4 ms 1772 KB Output is correct
29 Correct 3 ms 1748 KB Output is correct
30 Correct 6 ms 1768 KB Output is correct
31 Correct 3 ms 1724 KB Output is correct
32 Correct 6 ms 1748 KB Output is correct
33 Correct 3 ms 1768 KB Output is correct
34 Correct 3 ms 1748 KB Output is correct
35 Correct 2 ms 1620 KB Output is correct
36 Correct 2 ms 1620 KB Output is correct
37 Correct 2 ms 1620 KB Output is correct
38 Correct 2 ms 1492 KB Output is correct
39 Correct 2 ms 1544 KB Output is correct
40 Correct 4 ms 1900 KB Output is correct
41 Correct 2 ms 1516 KB Output is correct
42 Correct 4 ms 1876 KB Output is correct
43 Correct 3 ms 1876 KB Output is correct
44 Correct 1 ms 1492 KB Output is correct
45 Incorrect 35 ms 7532 KB Output isn't correct
46 Halted 0 ms 0 KB -