답안 #997715

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
997715 2024-06-12T18:10:24 Z MarwenElarbi Political Development (BOI17_politicaldevelopment) C++17
100 / 100
1256 ms 309588 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
#define ii pair<int,int>
const int nax=5e4+5;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<bitset<nax>> adj(nax);
int n,k;
int dfs(int x){
    int lst=x;
    auto cur=adj[x];
    int cnt=0;
    while(true){
        cnt++;
        cur&=adj[lst];
        vector<int> tab;
        for (int i = cur._Find_first(); (int)tab.size() < 10 && i < n; i=cur._Find_next(i))
        {
            tab.pb(i);
        }
        if(tab.size()==0) break;
        lst=tab[uniform_int_distribution<int>(0,(int)tab.size()-1)(rng)];
    }
    return cnt;
}
int main(){
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    cin>>n>>k;
    bool test=false;
    for (int i = 0; i < n; ++i)
    {
        int s;
        cin>>s;
        for (int j = 0; j < s; ++j)
        {
            int x;
            cin>>x;
            adj[i][x]=1;
        }
    }
    vector<int> per(n);
    for (int i = 0; i < n; ++i)
    {
        per[i]=i;
    }
    int ans=0;
    for (int i = 0; i < n*5; ++i)
    {
        if(i%n==0) shuffle(per.begin(),per.end(),rng);
        ans=max(ans,dfs(per[i%n]));
    }
    cout <<ans<<endl;
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:35:10: warning: unused variable 'test' [-Wunused-variable]
   35 |     bool test=false;
      |          ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 306516 KB Output is correct
2 Correct 42 ms 306308 KB Output is correct
3 Correct 86 ms 306520 KB Output is correct
4 Correct 80 ms 306524 KB Output is correct
5 Correct 96 ms 306524 KB Output is correct
6 Correct 77 ms 306512 KB Output is correct
7 Correct 82 ms 306548 KB Output is correct
8 Correct 61 ms 306516 KB Output is correct
9 Correct 39 ms 306372 KB Output is correct
10 Correct 58 ms 306536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 306516 KB Output is correct
2 Correct 42 ms 306308 KB Output is correct
3 Correct 86 ms 306520 KB Output is correct
4 Correct 80 ms 306524 KB Output is correct
5 Correct 96 ms 306524 KB Output is correct
6 Correct 77 ms 306512 KB Output is correct
7 Correct 82 ms 306548 KB Output is correct
8 Correct 61 ms 306516 KB Output is correct
9 Correct 39 ms 306372 KB Output is correct
10 Correct 58 ms 306536 KB Output is correct
11 Correct 100 ms 306520 KB Output is correct
12 Correct 81 ms 306536 KB Output is correct
13 Correct 40 ms 306512 KB Output is correct
14 Correct 87 ms 306536 KB Output is correct
15 Correct 38 ms 306512 KB Output is correct
16 Correct 95 ms 306520 KB Output is correct
17 Correct 39 ms 306368 KB Output is correct
18 Correct 80 ms 306568 KB Output is correct
19 Correct 59 ms 306512 KB Output is correct
20 Correct 105 ms 306516 KB Output is correct
21 Correct 84 ms 306512 KB Output is correct
22 Correct 60 ms 306512 KB Output is correct
23 Correct 85 ms 306592 KB Output is correct
24 Correct 62 ms 306368 KB Output is correct
25 Correct 82 ms 306432 KB Output is correct
26 Correct 87 ms 306540 KB Output is correct
27 Correct 92 ms 306600 KB Output is correct
28 Correct 82 ms 306396 KB Output is correct
29 Correct 90 ms 306512 KB Output is correct
30 Correct 83 ms 306612 KB Output is correct
31 Correct 86 ms 306612 KB Output is correct
32 Correct 90 ms 306620 KB Output is correct
33 Correct 89 ms 306512 KB Output is correct
34 Correct 88 ms 306612 KB Output is correct
35 Correct 62 ms 306512 KB Output is correct
36 Correct 62 ms 306516 KB Output is correct
37 Correct 60 ms 306472 KB Output is correct
38 Correct 52 ms 306772 KB Output is correct
39 Correct 52 ms 306524 KB Output is correct
40 Correct 87 ms 306512 KB Output is correct
41 Correct 50 ms 306512 KB Output is correct
42 Correct 86 ms 306516 KB Output is correct
43 Correct 111 ms 306516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 306512 KB Output is correct
2 Correct 40 ms 306512 KB Output is correct
3 Correct 38 ms 306408 KB Output is correct
4 Correct 38 ms 306516 KB Output is correct
5 Correct 41 ms 306380 KB Output is correct
6 Correct 39 ms 306520 KB Output is correct
7 Correct 40 ms 306516 KB Output is correct
8 Correct 40 ms 306276 KB Output is correct
9 Correct 38 ms 306500 KB Output is correct
10 Correct 39 ms 306768 KB Output is correct
11 Correct 743 ms 306540 KB Output is correct
12 Correct 35 ms 306512 KB Output is correct
13 Correct 808 ms 309584 KB Output is correct
14 Correct 38 ms 306516 KB Output is correct
15 Correct 752 ms 309588 KB Output is correct
16 Correct 784 ms 309360 KB Output is correct
17 Correct 769 ms 309332 KB Output is correct
18 Correct 766 ms 309324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 306516 KB Output is correct
2 Correct 42 ms 306308 KB Output is correct
3 Correct 86 ms 306520 KB Output is correct
4 Correct 80 ms 306524 KB Output is correct
5 Correct 96 ms 306524 KB Output is correct
6 Correct 77 ms 306512 KB Output is correct
7 Correct 82 ms 306548 KB Output is correct
8 Correct 61 ms 306516 KB Output is correct
9 Correct 39 ms 306372 KB Output is correct
10 Correct 58 ms 306536 KB Output is correct
11 Correct 100 ms 306520 KB Output is correct
12 Correct 81 ms 306536 KB Output is correct
13 Correct 40 ms 306512 KB Output is correct
14 Correct 87 ms 306536 KB Output is correct
15 Correct 38 ms 306512 KB Output is correct
16 Correct 95 ms 306520 KB Output is correct
17 Correct 39 ms 306368 KB Output is correct
18 Correct 80 ms 306568 KB Output is correct
19 Correct 59 ms 306512 KB Output is correct
20 Correct 105 ms 306516 KB Output is correct
21 Correct 84 ms 306512 KB Output is correct
22 Correct 60 ms 306512 KB Output is correct
23 Correct 85 ms 306592 KB Output is correct
24 Correct 62 ms 306368 KB Output is correct
25 Correct 82 ms 306432 KB Output is correct
26 Correct 87 ms 306540 KB Output is correct
27 Correct 92 ms 306600 KB Output is correct
28 Correct 82 ms 306396 KB Output is correct
29 Correct 90 ms 306512 KB Output is correct
30 Correct 83 ms 306612 KB Output is correct
31 Correct 86 ms 306612 KB Output is correct
32 Correct 90 ms 306620 KB Output is correct
33 Correct 89 ms 306512 KB Output is correct
34 Correct 88 ms 306612 KB Output is correct
35 Correct 62 ms 306512 KB Output is correct
36 Correct 62 ms 306516 KB Output is correct
37 Correct 60 ms 306472 KB Output is correct
38 Correct 52 ms 306772 KB Output is correct
39 Correct 52 ms 306524 KB Output is correct
40 Correct 87 ms 306512 KB Output is correct
41 Correct 50 ms 306512 KB Output is correct
42 Correct 86 ms 306516 KB Output is correct
43 Correct 111 ms 306516 KB Output is correct
44 Correct 267 ms 306748 KB Output is correct
45 Correct 43 ms 306512 KB Output is correct
46 Correct 90 ms 306528 KB Output is correct
47 Correct 89 ms 306516 KB Output is correct
48 Correct 89 ms 306516 KB Output is correct
49 Correct 105 ms 306516 KB Output is correct
50 Correct 94 ms 306740 KB Output is correct
51 Correct 98 ms 306868 KB Output is correct
52 Correct 81 ms 306516 KB Output is correct
53 Correct 95 ms 306768 KB Output is correct
54 Correct 92 ms 306832 KB Output is correct
55 Correct 87 ms 306772 KB Output is correct
56 Correct 95 ms 306516 KB Output is correct
57 Correct 60 ms 306520 KB Output is correct
58 Correct 99 ms 306836 KB Output is correct
59 Correct 187 ms 306512 KB Output is correct
60 Correct 85 ms 306512 KB Output is correct
61 Correct 157 ms 306512 KB Output is correct
62 Correct 170 ms 306516 KB Output is correct
63 Correct 268 ms 306740 KB Output is correct
64 Correct 237 ms 306724 KB Output is correct
65 Correct 94 ms 306512 KB Output is correct
66 Correct 168 ms 306608 KB Output is correct
67 Correct 115 ms 306612 KB Output is correct
68 Correct 288 ms 306516 KB Output is correct
69 Correct 100 ms 306532 KB Output is correct
70 Correct 100 ms 306516 KB Output is correct
71 Correct 113 ms 306768 KB Output is correct
72 Correct 107 ms 306584 KB Output is correct
73 Correct 86 ms 306544 KB Output is correct
74 Correct 110 ms 306964 KB Output is correct
75 Correct 109 ms 306672 KB Output is correct
76 Correct 96 ms 306512 KB Output is correct
77 Correct 89 ms 306768 KB Output is correct
78 Correct 86 ms 306516 KB Output is correct
79 Correct 63 ms 306664 KB Output is correct
80 Correct 88 ms 306512 KB Output is correct
81 Correct 89 ms 306772 KB Output is correct
82 Correct 51 ms 306512 KB Output is correct
83 Correct 65 ms 306472 KB Output is correct
84 Correct 120 ms 306768 KB Output is correct
85 Correct 49 ms 306512 KB Output is correct
86 Correct 94 ms 306572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 306516 KB Output is correct
2 Correct 42 ms 306308 KB Output is correct
3 Correct 86 ms 306520 KB Output is correct
4 Correct 80 ms 306524 KB Output is correct
5 Correct 96 ms 306524 KB Output is correct
6 Correct 77 ms 306512 KB Output is correct
7 Correct 82 ms 306548 KB Output is correct
8 Correct 61 ms 306516 KB Output is correct
9 Correct 39 ms 306372 KB Output is correct
10 Correct 58 ms 306536 KB Output is correct
11 Correct 100 ms 306520 KB Output is correct
12 Correct 81 ms 306536 KB Output is correct
13 Correct 40 ms 306512 KB Output is correct
14 Correct 87 ms 306536 KB Output is correct
15 Correct 38 ms 306512 KB Output is correct
16 Correct 95 ms 306520 KB Output is correct
17 Correct 39 ms 306368 KB Output is correct
18 Correct 80 ms 306568 KB Output is correct
19 Correct 59 ms 306512 KB Output is correct
20 Correct 105 ms 306516 KB Output is correct
21 Correct 84 ms 306512 KB Output is correct
22 Correct 60 ms 306512 KB Output is correct
23 Correct 85 ms 306592 KB Output is correct
24 Correct 62 ms 306368 KB Output is correct
25 Correct 82 ms 306432 KB Output is correct
26 Correct 87 ms 306540 KB Output is correct
27 Correct 92 ms 306600 KB Output is correct
28 Correct 82 ms 306396 KB Output is correct
29 Correct 90 ms 306512 KB Output is correct
30 Correct 83 ms 306612 KB Output is correct
31 Correct 86 ms 306612 KB Output is correct
32 Correct 90 ms 306620 KB Output is correct
33 Correct 89 ms 306512 KB Output is correct
34 Correct 88 ms 306612 KB Output is correct
35 Correct 62 ms 306512 KB Output is correct
36 Correct 62 ms 306516 KB Output is correct
37 Correct 60 ms 306472 KB Output is correct
38 Correct 52 ms 306772 KB Output is correct
39 Correct 52 ms 306524 KB Output is correct
40 Correct 87 ms 306512 KB Output is correct
41 Correct 50 ms 306512 KB Output is correct
42 Correct 86 ms 306516 KB Output is correct
43 Correct 111 ms 306516 KB Output is correct
44 Correct 39 ms 306512 KB Output is correct
45 Correct 716 ms 308500 KB Output is correct
46 Correct 697 ms 307412 KB Output is correct
47 Correct 746 ms 308328 KB Output is correct
48 Correct 685 ms 308564 KB Output is correct
49 Correct 469 ms 307284 KB Output is correct
50 Correct 599 ms 309068 KB Output is correct
51 Correct 679 ms 308680 KB Output is correct
52 Correct 501 ms 307380 KB Output is correct
53 Correct 470 ms 307284 KB Output is correct
54 Correct 295 ms 306820 KB Output is correct
55 Correct 613 ms 308812 KB Output is correct
56 Correct 643 ms 307024 KB Output is correct
57 Correct 511 ms 307280 KB Output is correct
58 Correct 1214 ms 307664 KB Output is correct
59 Correct 591 ms 307024 KB Output is correct
60 Correct 615 ms 306912 KB Output is correct
61 Correct 1256 ms 307672 KB Output is correct
62 Correct 920 ms 307388 KB Output is correct
63 Correct 688 ms 307792 KB Output is correct
64 Correct 584 ms 306988 KB Output is correct
65 Correct 790 ms 308052 KB Output is correct
66 Correct 870 ms 307148 KB Output is correct
67 Correct 661 ms 307792 KB Output is correct
68 Correct 718 ms 307892 KB Output is correct
69 Correct 726 ms 308304 KB Output is correct
70 Correct 614 ms 307284 KB Output is correct
71 Correct 673 ms 308216 KB Output is correct
72 Correct 591 ms 307772 KB Output is correct
73 Correct 675 ms 308024 KB Output is correct
74 Correct 602 ms 307536 KB Output is correct
75 Correct 338 ms 307028 KB Output is correct
76 Correct 588 ms 307536 KB Output is correct
77 Correct 704 ms 308048 KB Output is correct
78 Correct 363 ms 307252 KB Output is correct
79 Correct 342 ms 307028 KB Output is correct
80 Correct 202 ms 306772 KB Output is correct
81 Correct 352 ms 307284 KB Output is correct
82 Correct 661 ms 307708 KB Output is correct
83 Correct 161 ms 306844 KB Output is correct
84 Correct 658 ms 307788 KB Output is correct