Submission #933734

# Submission time Handle Problem Language Result Execution time Memory
933734 2024-02-26T08:21:47 Z LucaIlie Political Development (BOI17_politicaldevelopment) C++17
0 / 100
3000 ms 8020 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 5e4;
vector<int> adj[MAX_N];

int main() {
    int n, k, minn = n;

    cin >> n >> k;
    for ( int u = 0; u < n; u++ ) {
        int d;
        cin >> d;
        for ( int j = 0; j < d; j++ ) {
            int v;
            cin >> v;
            adj[u].push_back( v );
        }
        minn = min( minn, d );
    }

    int ans = 0;
    for ( int mask = 0; mask < (1 << n); mask++ ) {
        int sz = __builtin_popcount( mask );
        bool ok = true;
        for ( int u = 0; u < n; u++ ) {
            if ( ((mask >> u) & 1) == 0 )
                continue;

            int vec = 0;
            for ( int v: adj[u] ) {
                if ( (mask >> v) & 1 )
                    vec++;
            }

            if ( vec != sz - 1 )
                ok = false;
        }
        if ( ok )
            ans = max( ans, sz );
    }

    cout << ans;

    if ( minn > k )
        return 1;

    return 0;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:9:15: warning: 'n' is used uninitialized in this function [-Wuninitialized]
    9 |     int n, k, minn = n;
      |               ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1368 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Incorrect 6 ms 1628 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1368 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Incorrect 6 ms 1628 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 98 ms 1372 KB Output is correct
3 Correct 99 ms 1372 KB Output is correct
4 Correct 1 ms 1372 KB Output is correct
5 Correct 100 ms 1372 KB Output is correct
6 Correct 101 ms 1372 KB Output is correct
7 Correct 105 ms 1372 KB Output is correct
8 Correct 100 ms 1372 KB Output is correct
9 Correct 97 ms 1584 KB Output is correct
10 Correct 101 ms 1588 KB Output is correct
11 Execution timed out 3071 ms 8020 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1368 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Incorrect 6 ms 1628 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1368 KB Output is correct
2 Correct 1 ms 1372 KB Output is correct
3 Incorrect 6 ms 1628 KB Output isn't correct
4 Halted 0 ms 0 KB -