Submission #311109

# Submission time Handle Problem Language Result Execution time Memory
311109 2020-10-09T09:16:14 Z Vladth11 Political Development (BOI17_politicaldevelopment) C++14
16 / 100
3000 ms 6776 KB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debug_with_space(x) cerr << #x << " " << x << " "

using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
typedef pair <ll, pii> muchie;

const ll NMAX = 100005;
const ll INF = (1LL << 60);
const ll MOD = 1000000007;
const ll BLOCK = 101;

vector <int> v[NMAX];
int st[NMAX];

int main() {
    // ifstream cin("catsfood.in");
    // ofstream cout("catsfood.out");
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k, i, d;
    cin >> n >> k;
    for(i = 1; i <= n; i++) {
        int d;
        cin >> d;
        v[i].push_back(i);
        while(d--) {
            int x;
            cin >> x;
            v[i].push_back(x + 1);
        }
        sort(v[i].begin(), v[i].end());
    }
    int maxim = 0;
    for(i = 1; i <= n; i++) {
        int nrbits = v[i].size();
       // debug(i);
       if(nrbits > 10)
        continue;
        for(int mask = 1; mask < (1 << nrbits); mask++) {
            int cnt = 0;
            for(int j = nrbits - 1; j >= 0; j--) {
                if(mask & (1 << j)) {
                    for(auto x : v[v[i][j]]) {
                        if(st[x] != 0)
                            cnt++;
                    }
                    st[v[i][j]] = 1;
                }
            }
          for(int j = 0; j < nrbits;j++)
            st[v[i][j]] = 0;
            int bb = __builtin_popcount(mask);
         //   debug_with_space(mask);
           // debug(cnt);
            if(cnt == bb * (bb - 1) / 2)
                maxim = max(maxim, bb);
        }
    }
    cout << maxim;
    return 0;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:41:8: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   41 |        if(nrbits > 10)
      |        ^~
politicaldevelopment.cpp:43:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   43 |         for(int mask = 1; mask < (1 << nrbits); mask++) {
      |         ^~~
politicaldevelopment.cpp:54:11: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   54 |           for(int j = 0; j < nrbits;j++)
      |           ^~~
politicaldevelopment.cpp:56:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   56 |             int bb = __builtin_popcount(mask);
      |             ^~~
politicaldevelopment.cpp:24:18: warning: unused variable 'd' [-Wunused-variable]
   24 |     int n, k, i, d;
      |                  ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 3 ms 2688 KB Output is correct
3 Correct 10 ms 2816 KB Output is correct
4 Correct 46 ms 2936 KB Output is correct
5 Correct 43 ms 2936 KB Output is correct
6 Correct 5 ms 2944 KB Output is correct
7 Correct 5 ms 2944 KB Output is correct
8 Correct 3 ms 2816 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 3 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 3 ms 2688 KB Output is correct
3 Correct 10 ms 2816 KB Output is correct
4 Correct 46 ms 2936 KB Output is correct
5 Correct 43 ms 2936 KB Output is correct
6 Correct 5 ms 2944 KB Output is correct
7 Correct 5 ms 2944 KB Output is correct
8 Correct 3 ms 2816 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 3 ms 2816 KB Output is correct
11 Correct 44 ms 2816 KB Output is correct
12 Correct 44 ms 2816 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 44 ms 2936 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 5 ms 2944 KB Output is correct
17 Correct 3 ms 2688 KB Output is correct
18 Correct 5 ms 2944 KB Output is correct
19 Correct 3 ms 2816 KB Output is correct
20 Correct 4 ms 2816 KB Output is correct
21 Correct 6 ms 2816 KB Output is correct
22 Correct 4 ms 2816 KB Output is correct
23 Correct 11 ms 2816 KB Output is correct
24 Correct 3 ms 2848 KB Output is correct
25 Correct 11 ms 2816 KB Output is correct
26 Correct 11 ms 2816 KB Output is correct
27 Correct 5 ms 2816 KB Output is correct
28 Correct 13 ms 2944 KB Output is correct
29 Correct 5 ms 2816 KB Output is correct
30 Correct 41 ms 2816 KB Output is correct
31 Correct 36 ms 2816 KB Output is correct
32 Correct 32 ms 2944 KB Output is correct
33 Correct 9 ms 2816 KB Output is correct
34 Correct 22 ms 2816 KB Output is correct
35 Correct 5 ms 2816 KB Output is correct
36 Correct 6 ms 2816 KB Output is correct
37 Correct 5 ms 2816 KB Output is correct
38 Correct 4 ms 2688 KB Output is correct
39 Correct 4 ms 2688 KB Output is correct
40 Correct 47 ms 2944 KB Output is correct
41 Correct 4 ms 2688 KB Output is correct
42 Correct 40 ms 2960 KB Output is correct
43 Correct 39 ms 2944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2816 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 3 ms 2688 KB Output is correct
5 Correct 2 ms 2688 KB Output is correct
6 Correct 3 ms 2688 KB Output is correct
7 Correct 2 ms 2688 KB Output is correct
8 Correct 2 ms 2688 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Execution timed out 3051 ms 6776 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 3 ms 2688 KB Output is correct
3 Correct 10 ms 2816 KB Output is correct
4 Correct 46 ms 2936 KB Output is correct
5 Correct 43 ms 2936 KB Output is correct
6 Correct 5 ms 2944 KB Output is correct
7 Correct 5 ms 2944 KB Output is correct
8 Correct 3 ms 2816 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 3 ms 2816 KB Output is correct
11 Correct 44 ms 2816 KB Output is correct
12 Correct 44 ms 2816 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 44 ms 2936 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 5 ms 2944 KB Output is correct
17 Correct 3 ms 2688 KB Output is correct
18 Correct 5 ms 2944 KB Output is correct
19 Correct 3 ms 2816 KB Output is correct
20 Correct 4 ms 2816 KB Output is correct
21 Correct 6 ms 2816 KB Output is correct
22 Correct 4 ms 2816 KB Output is correct
23 Correct 11 ms 2816 KB Output is correct
24 Correct 3 ms 2848 KB Output is correct
25 Correct 11 ms 2816 KB Output is correct
26 Correct 11 ms 2816 KB Output is correct
27 Correct 5 ms 2816 KB Output is correct
28 Correct 13 ms 2944 KB Output is correct
29 Correct 5 ms 2816 KB Output is correct
30 Correct 41 ms 2816 KB Output is correct
31 Correct 36 ms 2816 KB Output is correct
32 Correct 32 ms 2944 KB Output is correct
33 Correct 9 ms 2816 KB Output is correct
34 Correct 22 ms 2816 KB Output is correct
35 Correct 5 ms 2816 KB Output is correct
36 Correct 6 ms 2816 KB Output is correct
37 Correct 5 ms 2816 KB Output is correct
38 Correct 4 ms 2688 KB Output is correct
39 Correct 4 ms 2688 KB Output is correct
40 Correct 47 ms 2944 KB Output is correct
41 Correct 4 ms 2688 KB Output is correct
42 Correct 40 ms 2960 KB Output is correct
43 Correct 39 ms 2944 KB Output is correct
44 Correct 254 ms 3192 KB Output is correct
45 Correct 2 ms 2688 KB Output is correct
46 Incorrect 44 ms 2944 KB Output isn't correct
47 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 3 ms 2688 KB Output is correct
3 Correct 10 ms 2816 KB Output is correct
4 Correct 46 ms 2936 KB Output is correct
5 Correct 43 ms 2936 KB Output is correct
6 Correct 5 ms 2944 KB Output is correct
7 Correct 5 ms 2944 KB Output is correct
8 Correct 3 ms 2816 KB Output is correct
9 Correct 2 ms 2688 KB Output is correct
10 Correct 3 ms 2816 KB Output is correct
11 Correct 44 ms 2816 KB Output is correct
12 Correct 44 ms 2816 KB Output is correct
13 Correct 2 ms 2688 KB Output is correct
14 Correct 44 ms 2936 KB Output is correct
15 Correct 2 ms 2688 KB Output is correct
16 Correct 5 ms 2944 KB Output is correct
17 Correct 3 ms 2688 KB Output is correct
18 Correct 5 ms 2944 KB Output is correct
19 Correct 3 ms 2816 KB Output is correct
20 Correct 4 ms 2816 KB Output is correct
21 Correct 6 ms 2816 KB Output is correct
22 Correct 4 ms 2816 KB Output is correct
23 Correct 11 ms 2816 KB Output is correct
24 Correct 3 ms 2848 KB Output is correct
25 Correct 11 ms 2816 KB Output is correct
26 Correct 11 ms 2816 KB Output is correct
27 Correct 5 ms 2816 KB Output is correct
28 Correct 13 ms 2944 KB Output is correct
29 Correct 5 ms 2816 KB Output is correct
30 Correct 41 ms 2816 KB Output is correct
31 Correct 36 ms 2816 KB Output is correct
32 Correct 32 ms 2944 KB Output is correct
33 Correct 9 ms 2816 KB Output is correct
34 Correct 22 ms 2816 KB Output is correct
35 Correct 5 ms 2816 KB Output is correct
36 Correct 6 ms 2816 KB Output is correct
37 Correct 5 ms 2816 KB Output is correct
38 Correct 4 ms 2688 KB Output is correct
39 Correct 4 ms 2688 KB Output is correct
40 Correct 47 ms 2944 KB Output is correct
41 Correct 4 ms 2688 KB Output is correct
42 Correct 40 ms 2960 KB Output is correct
43 Correct 39 ms 2944 KB Output is correct
44 Correct 2 ms 2688 KB Output is correct
45 Incorrect 794 ms 5624 KB Output isn't correct
46 Halted 0 ms 0 KB -