답안 #1115890

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115890 2024-11-21T03:37:46 Z flyingkite Political Development (BOI17_politicaldevelopment) C++17
100 / 100
723 ms 333052 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ll int
#define pll pair<long long, long long>
#define pb push_back
#define F first
#define S second  
#define all(x) (x).begin(), (x).end()
 
const ll N = 1e6 + 100;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll block = 1e3;
bitset<50005>b[50005], cur;
ll n,k;    
void to_thic_cau(){
    cin >> n >> k;
    vector<vector<ll>>prv;
    for(ll i = 0; i < n;i++){
        prv.pb({i});   
        ll sz; cin >> sz;
        while(sz--){
            ll v; cin >> v;
            b[min(i, v)][max(i, v)] = 1;
        }
    }
    for(int i = 2; i <= k + 1;i++){
        vector<vector<ll>>nxt;
        for(auto vec : prv){
            cur = b[vec[0]];
            for(int j = 1; j < vec.size();j++) cur &= b[vec[j]];
            for(int j = cur._Find_first(); j < n; j = cur._Find_next(j)){
                vector<ll>tmp = vec;
                tmp.pb(j);
                nxt.pb(tmp);
            }
        }
        prv.clear(); prv = nxt;
        if(!prv.size()){
            cout << i - 1 << "\n";
            return;
        } 
    }
}

signed main()
{   
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int tc = 1;   
    //cin >> tc;
    while(tc--) to_thic_cau();
}

Compilation message

politicaldevelopment.cpp:12:16: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   12 | const ll inf = 1e18;
      |                ^~~~
politicaldevelopment.cpp: In function 'void to_thic_cau()':
politicaldevelopment.cpp:32:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             for(int j = 1; j < vec.size();j++) cur &= b[vec[j]];
      |                            ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 31824 KB Output is correct
4 Correct 13 ms 11512 KB Output is correct
5 Correct 13 ms 13392 KB Output is correct
6 Correct 17 ms 31824 KB Output is correct
7 Correct 16 ms 31824 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 6 ms 3064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 31824 KB Output is correct
4 Correct 13 ms 11512 KB Output is correct
5 Correct 13 ms 13392 KB Output is correct
6 Correct 17 ms 31824 KB Output is correct
7 Correct 16 ms 31824 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 6 ms 3064 KB Output is correct
11 Correct 20 ms 9296 KB Output is correct
12 Correct 12 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 19668 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 18 ms 31824 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 15 ms 31824 KB Output is correct
19 Correct 5 ms 848 KB Output is correct
20 Correct 13 ms 31716 KB Output is correct
21 Correct 14 ms 31748 KB Output is correct
22 Correct 5 ms 2896 KB Output is correct
23 Correct 18 ms 31996 KB Output is correct
24 Correct 6 ms 2896 KB Output is correct
25 Correct 19 ms 31824 KB Output is correct
26 Correct 18 ms 31824 KB Output is correct
27 Correct 16 ms 31824 KB Output is correct
28 Correct 17 ms 31824 KB Output is correct
29 Correct 17 ms 31824 KB Output is correct
30 Correct 20 ms 32080 KB Output is correct
31 Correct 17 ms 32080 KB Output is correct
32 Correct 19 ms 32080 KB Output is correct
33 Correct 19 ms 31988 KB Output is correct
34 Correct 23 ms 32080 KB Output is correct
35 Correct 9 ms 17232 KB Output is correct
36 Correct 9 ms 17232 KB Output is correct
37 Correct 10 ms 17232 KB Output is correct
38 Correct 6 ms 9040 KB Output is correct
39 Correct 6 ms 9036 KB Output is correct
40 Correct 31 ms 32396 KB Output is correct
41 Correct 11 ms 9040 KB Output is correct
42 Correct 26 ms 32396 KB Output is correct
43 Correct 23 ms 32408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 848 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 448 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 465 ms 333048 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 426 ms 332184 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 434 ms 332152 KB Output is correct
16 Correct 441 ms 333040 KB Output is correct
17 Correct 439 ms 333052 KB Output is correct
18 Correct 445 ms 333036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 31824 KB Output is correct
4 Correct 13 ms 11512 KB Output is correct
5 Correct 13 ms 13392 KB Output is correct
6 Correct 17 ms 31824 KB Output is correct
7 Correct 16 ms 31824 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 6 ms 3064 KB Output is correct
11 Correct 20 ms 9296 KB Output is correct
12 Correct 12 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 19668 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 18 ms 31824 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 15 ms 31824 KB Output is correct
19 Correct 5 ms 848 KB Output is correct
20 Correct 13 ms 31716 KB Output is correct
21 Correct 14 ms 31748 KB Output is correct
22 Correct 5 ms 2896 KB Output is correct
23 Correct 18 ms 31996 KB Output is correct
24 Correct 6 ms 2896 KB Output is correct
25 Correct 19 ms 31824 KB Output is correct
26 Correct 18 ms 31824 KB Output is correct
27 Correct 16 ms 31824 KB Output is correct
28 Correct 17 ms 31824 KB Output is correct
29 Correct 17 ms 31824 KB Output is correct
30 Correct 20 ms 32080 KB Output is correct
31 Correct 17 ms 32080 KB Output is correct
32 Correct 19 ms 32080 KB Output is correct
33 Correct 19 ms 31988 KB Output is correct
34 Correct 23 ms 32080 KB Output is correct
35 Correct 9 ms 17232 KB Output is correct
36 Correct 9 ms 17232 KB Output is correct
37 Correct 10 ms 17232 KB Output is correct
38 Correct 6 ms 9040 KB Output is correct
39 Correct 6 ms 9036 KB Output is correct
40 Correct 31 ms 32396 KB Output is correct
41 Correct 11 ms 9040 KB Output is correct
42 Correct 26 ms 32396 KB Output is correct
43 Correct 23 ms 32408 KB Output is correct
44 Correct 688 ms 43076 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 26 ms 32396 KB Output is correct
47 Correct 40 ms 33544 KB Output is correct
48 Correct 25 ms 32396 KB Output is correct
49 Correct 40 ms 33556 KB Output is correct
50 Correct 45 ms 33544 KB Output is correct
51 Correct 78 ms 35824 KB Output is correct
52 Correct 13 ms 3152 KB Output is correct
53 Correct 71 ms 36356 KB Output is correct
54 Correct 103 ms 36356 KB Output is correct
55 Correct 16 ms 31824 KB Output is correct
56 Correct 12 ms 3152 KB Output is correct
57 Correct 5 ms 1016 KB Output is correct
58 Correct 72 ms 32260 KB Output is correct
59 Correct 60 ms 32800 KB Output is correct
60 Correct 17 ms 31824 KB Output is correct
61 Correct 57 ms 32740 KB Output is correct
62 Correct 56 ms 32752 KB Output is correct
63 Correct 723 ms 42044 KB Output is correct
64 Correct 377 ms 37144 KB Output is correct
65 Correct 24 ms 32396 KB Output is correct
66 Correct 60 ms 32784 KB Output is correct
67 Correct 195 ms 34228 KB Output is correct
68 Correct 352 ms 37148 KB Output is correct
69 Correct 25 ms 32396 KB Output is correct
70 Correct 56 ms 33348 KB Output is correct
71 Correct 208 ms 34056 KB Output is correct
72 Correct 125 ms 33800 KB Output is correct
73 Correct 16 ms 31824 KB Output is correct
74 Correct 54 ms 33288 KB Output is correct
75 Correct 120 ms 33968 KB Output is correct
76 Correct 31 ms 32908 KB Output is correct
77 Correct 52 ms 34568 KB Output is correct
78 Correct 17 ms 31824 KB Output is correct
79 Correct 25 ms 18572 KB Output is correct
80 Correct 43 ms 32908 KB Output is correct
81 Correct 53 ms 34568 KB Output is correct
82 Correct 6 ms 9040 KB Output is correct
83 Correct 22 ms 18572 KB Output is correct
84 Correct 46 ms 33800 KB Output is correct
85 Correct 7 ms 9040 KB Output is correct
86 Correct 50 ms 33936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 17 ms 31824 KB Output is correct
4 Correct 13 ms 11512 KB Output is correct
5 Correct 13 ms 13392 KB Output is correct
6 Correct 17 ms 31824 KB Output is correct
7 Correct 16 ms 31824 KB Output is correct
8 Correct 5 ms 848 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 6 ms 3064 KB Output is correct
11 Correct 20 ms 9296 KB Output is correct
12 Correct 12 ms 11344 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 15 ms 19668 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 18 ms 31824 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 15 ms 31824 KB Output is correct
19 Correct 5 ms 848 KB Output is correct
20 Correct 13 ms 31716 KB Output is correct
21 Correct 14 ms 31748 KB Output is correct
22 Correct 5 ms 2896 KB Output is correct
23 Correct 18 ms 31996 KB Output is correct
24 Correct 6 ms 2896 KB Output is correct
25 Correct 19 ms 31824 KB Output is correct
26 Correct 18 ms 31824 KB Output is correct
27 Correct 16 ms 31824 KB Output is correct
28 Correct 17 ms 31824 KB Output is correct
29 Correct 17 ms 31824 KB Output is correct
30 Correct 20 ms 32080 KB Output is correct
31 Correct 17 ms 32080 KB Output is correct
32 Correct 19 ms 32080 KB Output is correct
33 Correct 19 ms 31988 KB Output is correct
34 Correct 23 ms 32080 KB Output is correct
35 Correct 9 ms 17232 KB Output is correct
36 Correct 9 ms 17232 KB Output is correct
37 Correct 10 ms 17232 KB Output is correct
38 Correct 6 ms 9040 KB Output is correct
39 Correct 6 ms 9036 KB Output is correct
40 Correct 31 ms 32396 KB Output is correct
41 Correct 11 ms 9040 KB Output is correct
42 Correct 26 ms 32396 KB Output is correct
43 Correct 23 ms 32408 KB Output is correct
44 Correct 1 ms 504 KB Output is correct
45 Correct 345 ms 302836 KB Output is correct
46 Correct 227 ms 303788 KB Output is correct
47 Correct 345 ms 309200 KB Output is correct
48 Correct 355 ms 305644 KB Output is correct
49 Correct 140 ms 199328 KB Output is correct
50 Correct 435 ms 308716 KB Output is correct
51 Correct 339 ms 301056 KB Output is correct
52 Correct 149 ms 292088 KB Output is correct
53 Correct 134 ms 215548 KB Output is correct
54 Correct 39 ms 3588 KB Output is correct
55 Correct 356 ms 319416 KB Output is correct
56 Correct 120 ms 288516 KB Output is correct
57 Correct 157 ms 282108 KB Output is correct
58 Correct 319 ms 287480 KB Output is correct
59 Correct 119 ms 282636 KB Output is correct
60 Correct 122 ms 292356 KB Output is correct
61 Correct 348 ms 289888 KB Output is correct
62 Correct 210 ms 279708 KB Output is correct
63 Correct 265 ms 291440 KB Output is correct
64 Correct 133 ms 286460 KB Output is correct
65 Correct 331 ms 284156 KB Output is correct
66 Correct 222 ms 276316 KB Output is correct
67 Correct 256 ms 283024 KB Output is correct
68 Correct 280 ms 296956 KB Output is correct
69 Correct 331 ms 301304 KB Output is correct
70 Correct 172 ms 290456 KB Output is correct
71 Correct 282 ms 298688 KB Output is correct
72 Correct 233 ms 285952 KB Output is correct
73 Correct 312 ms 293876 KB Output is correct
74 Correct 171 ms 292348 KB Output is correct
75 Correct 127 ms 160252 KB Output is correct
76 Correct 238 ms 276852 KB Output is correct
77 Correct 328 ms 283132 KB Output is correct
78 Correct 156 ms 162044 KB Output is correct
79 Correct 126 ms 158220 KB Output is correct
80 Correct 61 ms 79360 KB Output is correct
81 Correct 150 ms 162104 KB Output is correct
82 Correct 263 ms 286712 KB Output is correct
83 Correct 62 ms 81448 KB Output is correct
84 Correct 276 ms 266740 KB Output is correct