답안 #994489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
994489 2024-06-07T17:47:58 Z amine_aroua Political Development (BOI17_politicaldevelopment) C++17
100 / 100
979 ms 307028 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define int long long
#define pb push_back
#define nl '\n'
#define fore(i, y) for(int i = 0; i < y; i++)
#define forr(i, x, y) for(int i = x;i<=y;i++)
#define forn(i, y, x) for(int i = y; i >= x; i--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 50000;
vector<bitset<N>> adj(N , 0);
int n , k;
bitset<N> cur = 0;
//bool done[N];
int maxClique(int i)
{
    cur = adj[i];
    int last = i;
    int cnt = 0;
    while(true)
    {
        cnt++;
        cur&=adj[last];
        vector<int> candidates;
        for(int j = cur._Find_first() ; (int)candidates.size() < 10 && j < N ; j = cur._Find_next(j))
        {
            candidates.pb(j);
        }
        if(candidates.empty())
            break;
        last = candidates[uniform_int_distribution<int>(0 , (int)candidates.size() - 1)(rng)];
    }
    return cnt;
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>k;

    fore(i , n)
    {
        int d;
        cin>>d;
        fore(j , d)
        {
            int x;
            cin>>x;
            if(x != i)
                adj[i][x] = 1;
        }
    }
    int best = 0;
    vector<int> p(n);
    fore(i , n)
        p[i] = i;
    fore(i , 5 * n)
    {
        if(i % n == 0)
        {
            shuffle(p.begin() , p.end() , rng);
        }
        best = max(best , maxClique(p[i%n]));
    }
    cout<<best<<nl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 306516 KB Output is correct
2 Correct 85 ms 306440 KB Output is correct
3 Correct 111 ms 306484 KB Output is correct
4 Correct 133 ms 306556 KB Output is correct
5 Correct 129 ms 306512 KB Output is correct
6 Correct 118 ms 306516 KB Output is correct
7 Correct 119 ms 306524 KB Output is correct
8 Correct 99 ms 306516 KB Output is correct
9 Correct 87 ms 306512 KB Output is correct
10 Correct 118 ms 306516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 306516 KB Output is correct
2 Correct 85 ms 306440 KB Output is correct
3 Correct 111 ms 306484 KB Output is correct
4 Correct 133 ms 306556 KB Output is correct
5 Correct 129 ms 306512 KB Output is correct
6 Correct 118 ms 306516 KB Output is correct
7 Correct 119 ms 306524 KB Output is correct
8 Correct 99 ms 306516 KB Output is correct
9 Correct 87 ms 306512 KB Output is correct
10 Correct 118 ms 306516 KB Output is correct
11 Correct 109 ms 306516 KB Output is correct
12 Correct 108 ms 306380 KB Output is correct
13 Correct 87 ms 306488 KB Output is correct
14 Correct 108 ms 306512 KB Output is correct
15 Correct 89 ms 306516 KB Output is correct
16 Correct 106 ms 306516 KB Output is correct
17 Correct 87 ms 306460 KB Output is correct
18 Correct 110 ms 306516 KB Output is correct
19 Correct 102 ms 306512 KB Output is correct
20 Correct 112 ms 306516 KB Output is correct
21 Correct 112 ms 306516 KB Output is correct
22 Correct 103 ms 306516 KB Output is correct
23 Correct 116 ms 306516 KB Output is correct
24 Correct 97 ms 306516 KB Output is correct
25 Correct 113 ms 306516 KB Output is correct
26 Correct 114 ms 306512 KB Output is correct
27 Correct 111 ms 306516 KB Output is correct
28 Correct 114 ms 306512 KB Output is correct
29 Correct 118 ms 306520 KB Output is correct
30 Correct 127 ms 306464 KB Output is correct
31 Correct 117 ms 306512 KB Output is correct
32 Correct 115 ms 306512 KB Output is correct
33 Correct 112 ms 306400 KB Output is correct
34 Correct 115 ms 306512 KB Output is correct
35 Correct 100 ms 306516 KB Output is correct
36 Correct 111 ms 306468 KB Output is correct
37 Correct 101 ms 306516 KB Output is correct
38 Correct 90 ms 306516 KB Output is correct
39 Correct 91 ms 306516 KB Output is correct
40 Correct 121 ms 306516 KB Output is correct
41 Correct 88 ms 306520 KB Output is correct
42 Correct 114 ms 306544 KB Output is correct
43 Correct 119 ms 306516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 109 ms 306512 KB Output is correct
2 Correct 84 ms 306516 KB Output is correct
3 Correct 81 ms 306512 KB Output is correct
4 Correct 83 ms 306512 KB Output is correct
5 Correct 82 ms 306512 KB Output is correct
6 Correct 83 ms 306516 KB Output is correct
7 Correct 86 ms 306428 KB Output is correct
8 Correct 85 ms 306512 KB Output is correct
9 Correct 83 ms 306516 KB Output is correct
10 Correct 87 ms 306480 KB Output is correct
11 Correct 648 ms 306768 KB Output is correct
12 Correct 85 ms 306264 KB Output is correct
13 Correct 673 ms 306772 KB Output is correct
14 Correct 87 ms 306516 KB Output is correct
15 Correct 639 ms 306924 KB Output is correct
16 Correct 689 ms 306920 KB Output is correct
17 Correct 621 ms 306924 KB Output is correct
18 Correct 636 ms 306772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 306516 KB Output is correct
2 Correct 85 ms 306440 KB Output is correct
3 Correct 111 ms 306484 KB Output is correct
4 Correct 133 ms 306556 KB Output is correct
5 Correct 129 ms 306512 KB Output is correct
6 Correct 118 ms 306516 KB Output is correct
7 Correct 119 ms 306524 KB Output is correct
8 Correct 99 ms 306516 KB Output is correct
9 Correct 87 ms 306512 KB Output is correct
10 Correct 118 ms 306516 KB Output is correct
11 Correct 109 ms 306516 KB Output is correct
12 Correct 108 ms 306380 KB Output is correct
13 Correct 87 ms 306488 KB Output is correct
14 Correct 108 ms 306512 KB Output is correct
15 Correct 89 ms 306516 KB Output is correct
16 Correct 106 ms 306516 KB Output is correct
17 Correct 87 ms 306460 KB Output is correct
18 Correct 110 ms 306516 KB Output is correct
19 Correct 102 ms 306512 KB Output is correct
20 Correct 112 ms 306516 KB Output is correct
21 Correct 112 ms 306516 KB Output is correct
22 Correct 103 ms 306516 KB Output is correct
23 Correct 116 ms 306516 KB Output is correct
24 Correct 97 ms 306516 KB Output is correct
25 Correct 113 ms 306516 KB Output is correct
26 Correct 114 ms 306512 KB Output is correct
27 Correct 111 ms 306516 KB Output is correct
28 Correct 114 ms 306512 KB Output is correct
29 Correct 118 ms 306520 KB Output is correct
30 Correct 127 ms 306464 KB Output is correct
31 Correct 117 ms 306512 KB Output is correct
32 Correct 115 ms 306512 KB Output is correct
33 Correct 112 ms 306400 KB Output is correct
34 Correct 115 ms 306512 KB Output is correct
35 Correct 100 ms 306516 KB Output is correct
36 Correct 111 ms 306468 KB Output is correct
37 Correct 101 ms 306516 KB Output is correct
38 Correct 90 ms 306516 KB Output is correct
39 Correct 91 ms 306516 KB Output is correct
40 Correct 121 ms 306516 KB Output is correct
41 Correct 88 ms 306520 KB Output is correct
42 Correct 114 ms 306544 KB Output is correct
43 Correct 119 ms 306516 KB Output is correct
44 Correct 223 ms 306512 KB Output is correct
45 Correct 86 ms 306512 KB Output is correct
46 Correct 116 ms 306348 KB Output is correct
47 Correct 118 ms 306516 KB Output is correct
48 Correct 112 ms 306780 KB Output is correct
49 Correct 113 ms 306516 KB Output is correct
50 Correct 121 ms 306512 KB Output is correct
51 Correct 124 ms 306512 KB Output is correct
52 Correct 112 ms 306512 KB Output is correct
53 Correct 117 ms 306516 KB Output is correct
54 Correct 116 ms 306516 KB Output is correct
55 Correct 142 ms 306308 KB Output is correct
56 Correct 107 ms 306516 KB Output is correct
57 Correct 102 ms 306516 KB Output is correct
58 Correct 117 ms 306528 KB Output is correct
59 Correct 154 ms 306516 KB Output is correct
60 Correct 121 ms 306460 KB Output is correct
61 Correct 160 ms 306516 KB Output is correct
62 Correct 159 ms 306504 KB Output is correct
63 Correct 210 ms 306516 KB Output is correct
64 Correct 211 ms 306512 KB Output is correct
65 Correct 116 ms 306512 KB Output is correct
66 Correct 159 ms 306516 KB Output is correct
67 Correct 129 ms 306508 KB Output is correct
68 Correct 218 ms 306516 KB Output is correct
69 Correct 115 ms 306516 KB Output is correct
70 Correct 127 ms 306512 KB Output is correct
71 Correct 136 ms 306516 KB Output is correct
72 Correct 129 ms 306328 KB Output is correct
73 Correct 122 ms 306472 KB Output is correct
74 Correct 125 ms 306508 KB Output is correct
75 Correct 138 ms 306516 KB Output is correct
76 Correct 121 ms 306428 KB Output is correct
77 Correct 124 ms 306512 KB Output is correct
78 Correct 116 ms 306512 KB Output is correct
79 Correct 107 ms 306512 KB Output is correct
80 Correct 123 ms 306516 KB Output is correct
81 Correct 127 ms 306512 KB Output is correct
82 Correct 91 ms 306516 KB Output is correct
83 Correct 100 ms 306400 KB Output is correct
84 Correct 127 ms 306512 KB Output is correct
85 Correct 93 ms 306504 KB Output is correct
86 Correct 124 ms 306340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 306516 KB Output is correct
2 Correct 85 ms 306440 KB Output is correct
3 Correct 111 ms 306484 KB Output is correct
4 Correct 133 ms 306556 KB Output is correct
5 Correct 129 ms 306512 KB Output is correct
6 Correct 118 ms 306516 KB Output is correct
7 Correct 119 ms 306524 KB Output is correct
8 Correct 99 ms 306516 KB Output is correct
9 Correct 87 ms 306512 KB Output is correct
10 Correct 118 ms 306516 KB Output is correct
11 Correct 109 ms 306516 KB Output is correct
12 Correct 108 ms 306380 KB Output is correct
13 Correct 87 ms 306488 KB Output is correct
14 Correct 108 ms 306512 KB Output is correct
15 Correct 89 ms 306516 KB Output is correct
16 Correct 106 ms 306516 KB Output is correct
17 Correct 87 ms 306460 KB Output is correct
18 Correct 110 ms 306516 KB Output is correct
19 Correct 102 ms 306512 KB Output is correct
20 Correct 112 ms 306516 KB Output is correct
21 Correct 112 ms 306516 KB Output is correct
22 Correct 103 ms 306516 KB Output is correct
23 Correct 116 ms 306516 KB Output is correct
24 Correct 97 ms 306516 KB Output is correct
25 Correct 113 ms 306516 KB Output is correct
26 Correct 114 ms 306512 KB Output is correct
27 Correct 111 ms 306516 KB Output is correct
28 Correct 114 ms 306512 KB Output is correct
29 Correct 118 ms 306520 KB Output is correct
30 Correct 127 ms 306464 KB Output is correct
31 Correct 117 ms 306512 KB Output is correct
32 Correct 115 ms 306512 KB Output is correct
33 Correct 112 ms 306400 KB Output is correct
34 Correct 115 ms 306512 KB Output is correct
35 Correct 100 ms 306516 KB Output is correct
36 Correct 111 ms 306468 KB Output is correct
37 Correct 101 ms 306516 KB Output is correct
38 Correct 90 ms 306516 KB Output is correct
39 Correct 91 ms 306516 KB Output is correct
40 Correct 121 ms 306516 KB Output is correct
41 Correct 88 ms 306520 KB Output is correct
42 Correct 114 ms 306544 KB Output is correct
43 Correct 119 ms 306516 KB Output is correct
44 Correct 90 ms 306372 KB Output is correct
45 Correct 576 ms 306948 KB Output is correct
46 Correct 591 ms 306772 KB Output is correct
47 Correct 584 ms 306920 KB Output is correct
48 Correct 576 ms 306892 KB Output is correct
49 Correct 380 ms 306908 KB Output is correct
50 Correct 419 ms 306772 KB Output is correct
51 Correct 575 ms 306772 KB Output is correct
52 Correct 409 ms 306768 KB Output is correct
53 Correct 387 ms 306768 KB Output is correct
54 Correct 301 ms 307028 KB Output is correct
55 Correct 444 ms 306772 KB Output is correct
56 Correct 520 ms 306912 KB Output is correct
57 Correct 431 ms 306772 KB Output is correct
58 Correct 979 ms 306896 KB Output is correct
59 Correct 501 ms 306712 KB Output is correct
60 Correct 517 ms 306920 KB Output is correct
61 Correct 971 ms 306768 KB Output is correct
62 Correct 734 ms 306812 KB Output is correct
63 Correct 576 ms 306768 KB Output is correct
64 Correct 520 ms 306768 KB Output is correct
65 Correct 596 ms 306916 KB Output is correct
66 Correct 729 ms 306768 KB Output is correct
67 Correct 564 ms 306896 KB Output is correct
68 Correct 573 ms 306816 KB Output is correct
69 Correct 605 ms 306772 KB Output is correct
70 Correct 500 ms 306772 KB Output is correct
71 Correct 589 ms 306776 KB Output is correct
72 Correct 495 ms 307028 KB Output is correct
73 Correct 585 ms 306772 KB Output is correct
74 Correct 537 ms 306812 KB Output is correct
75 Correct 303 ms 306512 KB Output is correct
76 Correct 496 ms 306768 KB Output is correct
77 Correct 580 ms 306920 KB Output is correct
78 Correct 313 ms 306516 KB Output is correct
79 Correct 298 ms 306520 KB Output is correct
80 Correct 173 ms 306512 KB Output is correct
81 Correct 304 ms 306708 KB Output is correct
82 Correct 559 ms 307024 KB Output is correct
83 Correct 166 ms 306452 KB Output is correct
84 Correct 555 ms 306768 KB Output is correct