#pragma optimize("Bismillahirrahmanirrahim")
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//ahmet23 orz...
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
//Sani buyuk Osman Pasa Plevneden cikmam diyor
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename X, typename Y> istream& operator>>(istream& is, pair<X,Y> &pr){return is>>pr.first>>pr.second;}
#ifdef tolbi
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr){return os<<"{ "<<pr.first<<", "<<pr.second<<" }";}
#else
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr){return os<<pr.first<<" "<<pr.second;}
#endif
ostream& operator<<(ostream& os, bool bl){return os<<(int32_t)bl;}
template<typename X> istream& operator>>(istream& is, vector<X> &arr){for (auto &it : arr) is>>it; return is;}
template<typename X, size_t Y> istream& operator>>(istream& is, array<X,Y> &arr){for (auto &it : arr) is>>it; return is;}
template<typename X> ostream& operator<<(ostream& os, vector<X> &arr){for (auto &it : arr) os<<" "<<it;os<<endl;return os;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> &arr){for (auto &it : arr) os<<" "<<it;os<<endl;return os;}
#define endl '\n'
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for(auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define rev(x) reverse(x.begin(), x.end())
#define tol(bi) (1LL<<((int)(bi)))
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
int32_t main(){
ios;
int T = 1;
if (!T) cin>>T;
int tno = 0;
while (T-(tno++)){
bitset<50000> full;
deci(n);deci(k);
vector<vector<int>> gr(n);
vector<pair<int,int>> pr(n);
vector<bitset<50000>> arr(n);
for (int i = 0; i < n; ++i)
{
pr[i].second=i;
full[i]=1;
cin>>pr[i].first;
for (int j = 0; j < pr[i].first; j++){
deci(x);
gr[i].push_back(x);
}
}
sortarr(pr);
vector<int> pl(n);
for (int i = 0; i < n; ++i)
{
pl[pr[i].second]=i;
}
for (int i = 0; i < n; i++){
int node = pl[i];
for (int j = 0; j < gr[i].size(); j++){
int nex = pl[gr[i][j]];
arr[node][nex]=1;
}
}
bitset<50000> kk;
auto f = [&](bitset<50000> bs, int dept, auto f)->int{
if (dept==k) return 0;
int mava = 0;
if (bs.count()==0) return 0;
int pos = bs._Find_first();
while (pos<50000){
bs[pos]=0;
kk=bs&arr[pos];
mava=max(mava,f(kk,dept+1,f)+1);
pos=bs._Find_next(pos);
}
return mava;
};
cout<<f(full,0,f)<<endl;
}
}
Compilation message
politicaldevelopment.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim")
|
politicaldevelopment.cpp: In function 'int32_t main()':
politicaldevelopment.cpp:67:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
67 | for (int j = 0; j < gr[i].size(); j++){
| ~~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
23 ms |
31264 KB |
Output is correct |
4 |
Correct |
22 ms |
31236 KB |
Output is correct |
5 |
Correct |
22 ms |
31316 KB |
Output is correct |
6 |
Correct |
23 ms |
31316 KB |
Output is correct |
7 |
Correct |
26 ms |
31316 KB |
Output is correct |
8 |
Correct |
18 ms |
31144 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
17 ms |
31124 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
23 ms |
31264 KB |
Output is correct |
4 |
Correct |
22 ms |
31236 KB |
Output is correct |
5 |
Correct |
22 ms |
31316 KB |
Output is correct |
6 |
Correct |
23 ms |
31316 KB |
Output is correct |
7 |
Correct |
26 ms |
31316 KB |
Output is correct |
8 |
Correct |
18 ms |
31144 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
17 ms |
31124 KB |
Output is correct |
11 |
Correct |
22 ms |
31316 KB |
Output is correct |
12 |
Correct |
24 ms |
31316 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
23 ms |
31316 KB |
Output is correct |
15 |
Correct |
0 ms |
340 KB |
Output is correct |
16 |
Correct |
25 ms |
31316 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
25 ms |
31316 KB |
Output is correct |
19 |
Correct |
18 ms |
31060 KB |
Output is correct |
20 |
Correct |
22 ms |
31272 KB |
Output is correct |
21 |
Correct |
23 ms |
31228 KB |
Output is correct |
22 |
Correct |
18 ms |
31084 KB |
Output is correct |
23 |
Correct |
28 ms |
31316 KB |
Output is correct |
24 |
Correct |
19 ms |
31140 KB |
Output is correct |
25 |
Correct |
28 ms |
31260 KB |
Output is correct |
26 |
Correct |
27 ms |
31196 KB |
Output is correct |
27 |
Correct |
25 ms |
31316 KB |
Output is correct |
28 |
Correct |
26 ms |
31316 KB |
Output is correct |
29 |
Correct |
25 ms |
31196 KB |
Output is correct |
30 |
Correct |
27 ms |
31296 KB |
Output is correct |
31 |
Correct |
27 ms |
31248 KB |
Output is correct |
32 |
Correct |
27 ms |
31248 KB |
Output is correct |
33 |
Correct |
27 ms |
31316 KB |
Output is correct |
34 |
Correct |
27 ms |
31260 KB |
Output is correct |
35 |
Correct |
13 ms |
15800 KB |
Output is correct |
36 |
Correct |
18 ms |
15828 KB |
Output is correct |
37 |
Correct |
13 ms |
15828 KB |
Output is correct |
38 |
Correct |
7 ms |
8020 KB |
Output is correct |
39 |
Correct |
7 ms |
8020 KB |
Output is correct |
40 |
Correct |
30 ms |
31304 KB |
Output is correct |
41 |
Correct |
7 ms |
8020 KB |
Output is correct |
42 |
Correct |
32 ms |
31300 KB |
Output is correct |
43 |
Correct |
32 ms |
31316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
31060 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
468 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
501 ms |
312116 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
493 ms |
312296 KB |
Output is correct |
14 |
Correct |
1 ms |
468 KB |
Output is correct |
15 |
Correct |
489 ms |
312120 KB |
Output is correct |
16 |
Correct |
497 ms |
312016 KB |
Output is correct |
17 |
Correct |
491 ms |
312228 KB |
Output is correct |
18 |
Correct |
513 ms |
312188 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
23 ms |
31264 KB |
Output is correct |
4 |
Correct |
22 ms |
31236 KB |
Output is correct |
5 |
Correct |
22 ms |
31316 KB |
Output is correct |
6 |
Correct |
23 ms |
31316 KB |
Output is correct |
7 |
Correct |
26 ms |
31316 KB |
Output is correct |
8 |
Correct |
18 ms |
31144 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
17 ms |
31124 KB |
Output is correct |
11 |
Correct |
22 ms |
31316 KB |
Output is correct |
12 |
Correct |
24 ms |
31316 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
23 ms |
31316 KB |
Output is correct |
15 |
Correct |
0 ms |
340 KB |
Output is correct |
16 |
Correct |
25 ms |
31316 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
25 ms |
31316 KB |
Output is correct |
19 |
Correct |
18 ms |
31060 KB |
Output is correct |
20 |
Correct |
22 ms |
31272 KB |
Output is correct |
21 |
Correct |
23 ms |
31228 KB |
Output is correct |
22 |
Correct |
18 ms |
31084 KB |
Output is correct |
23 |
Correct |
28 ms |
31316 KB |
Output is correct |
24 |
Correct |
19 ms |
31140 KB |
Output is correct |
25 |
Correct |
28 ms |
31260 KB |
Output is correct |
26 |
Correct |
27 ms |
31196 KB |
Output is correct |
27 |
Correct |
25 ms |
31316 KB |
Output is correct |
28 |
Correct |
26 ms |
31316 KB |
Output is correct |
29 |
Correct |
25 ms |
31196 KB |
Output is correct |
30 |
Correct |
27 ms |
31296 KB |
Output is correct |
31 |
Correct |
27 ms |
31248 KB |
Output is correct |
32 |
Correct |
27 ms |
31248 KB |
Output is correct |
33 |
Correct |
27 ms |
31316 KB |
Output is correct |
34 |
Correct |
27 ms |
31260 KB |
Output is correct |
35 |
Correct |
13 ms |
15800 KB |
Output is correct |
36 |
Correct |
18 ms |
15828 KB |
Output is correct |
37 |
Correct |
13 ms |
15828 KB |
Output is correct |
38 |
Correct |
7 ms |
8020 KB |
Output is correct |
39 |
Correct |
7 ms |
8020 KB |
Output is correct |
40 |
Correct |
30 ms |
31304 KB |
Output is correct |
41 |
Correct |
7 ms |
8020 KB |
Output is correct |
42 |
Correct |
32 ms |
31300 KB |
Output is correct |
43 |
Correct |
32 ms |
31316 KB |
Output is correct |
44 |
Correct |
318 ms |
31408 KB |
Output is correct |
45 |
Correct |
1 ms |
340 KB |
Output is correct |
46 |
Correct |
31 ms |
31424 KB |
Output is correct |
47 |
Correct |
42 ms |
31572 KB |
Output is correct |
48 |
Correct |
31 ms |
31428 KB |
Output is correct |
49 |
Correct |
52 ms |
31596 KB |
Output is correct |
50 |
Correct |
52 ms |
31628 KB |
Output is correct |
51 |
Correct |
81 ms |
32060 KB |
Output is correct |
52 |
Correct |
23 ms |
31372 KB |
Output is correct |
53 |
Correct |
60 ms |
32180 KB |
Output is correct |
54 |
Correct |
76 ms |
32172 KB |
Output is correct |
55 |
Correct |
25 ms |
31420 KB |
Output is correct |
56 |
Correct |
23 ms |
31316 KB |
Output is correct |
57 |
Correct |
18 ms |
31168 KB |
Output is correct |
58 |
Correct |
65 ms |
32196 KB |
Output is correct |
59 |
Correct |
48 ms |
31444 KB |
Output is correct |
60 |
Correct |
27 ms |
31316 KB |
Output is correct |
61 |
Correct |
48 ms |
31444 KB |
Output is correct |
62 |
Correct |
48 ms |
31444 KB |
Output is correct |
63 |
Correct |
309 ms |
31620 KB |
Output is correct |
64 |
Correct |
181 ms |
31592 KB |
Output is correct |
65 |
Correct |
31 ms |
31412 KB |
Output is correct |
66 |
Correct |
49 ms |
31340 KB |
Output is correct |
67 |
Correct |
112 ms |
31788 KB |
Output is correct |
68 |
Correct |
185 ms |
31700 KB |
Output is correct |
69 |
Correct |
31 ms |
31316 KB |
Output is correct |
70 |
Correct |
49 ms |
31564 KB |
Output is correct |
71 |
Correct |
110 ms |
31664 KB |
Output is correct |
72 |
Correct |
80 ms |
31712 KB |
Output is correct |
73 |
Correct |
25 ms |
31316 KB |
Output is correct |
74 |
Correct |
50 ms |
31572 KB |
Output is correct |
75 |
Correct |
87 ms |
31780 KB |
Output is correct |
76 |
Correct |
33 ms |
31444 KB |
Output is correct |
77 |
Correct |
53 ms |
31784 KB |
Output is correct |
78 |
Correct |
24 ms |
31324 KB |
Output is correct |
79 |
Correct |
25 ms |
16108 KB |
Output is correct |
80 |
Correct |
33 ms |
31456 KB |
Output is correct |
81 |
Correct |
52 ms |
31812 KB |
Output is correct |
82 |
Correct |
9 ms |
8020 KB |
Output is correct |
83 |
Correct |
24 ms |
16084 KB |
Output is correct |
84 |
Correct |
46 ms |
31772 KB |
Output is correct |
85 |
Correct |
7 ms |
8020 KB |
Output is correct |
86 |
Correct |
45 ms |
31800 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
23 ms |
31264 KB |
Output is correct |
4 |
Correct |
22 ms |
31236 KB |
Output is correct |
5 |
Correct |
22 ms |
31316 KB |
Output is correct |
6 |
Correct |
23 ms |
31316 KB |
Output is correct |
7 |
Correct |
26 ms |
31316 KB |
Output is correct |
8 |
Correct |
18 ms |
31144 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
17 ms |
31124 KB |
Output is correct |
11 |
Correct |
22 ms |
31316 KB |
Output is correct |
12 |
Correct |
24 ms |
31316 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
23 ms |
31316 KB |
Output is correct |
15 |
Correct |
0 ms |
340 KB |
Output is correct |
16 |
Correct |
25 ms |
31316 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
25 ms |
31316 KB |
Output is correct |
19 |
Correct |
18 ms |
31060 KB |
Output is correct |
20 |
Correct |
22 ms |
31272 KB |
Output is correct |
21 |
Correct |
23 ms |
31228 KB |
Output is correct |
22 |
Correct |
18 ms |
31084 KB |
Output is correct |
23 |
Correct |
28 ms |
31316 KB |
Output is correct |
24 |
Correct |
19 ms |
31140 KB |
Output is correct |
25 |
Correct |
28 ms |
31260 KB |
Output is correct |
26 |
Correct |
27 ms |
31196 KB |
Output is correct |
27 |
Correct |
25 ms |
31316 KB |
Output is correct |
28 |
Correct |
26 ms |
31316 KB |
Output is correct |
29 |
Correct |
25 ms |
31196 KB |
Output is correct |
30 |
Correct |
27 ms |
31296 KB |
Output is correct |
31 |
Correct |
27 ms |
31248 KB |
Output is correct |
32 |
Correct |
27 ms |
31248 KB |
Output is correct |
33 |
Correct |
27 ms |
31316 KB |
Output is correct |
34 |
Correct |
27 ms |
31260 KB |
Output is correct |
35 |
Correct |
13 ms |
15800 KB |
Output is correct |
36 |
Correct |
18 ms |
15828 KB |
Output is correct |
37 |
Correct |
13 ms |
15828 KB |
Output is correct |
38 |
Correct |
7 ms |
8020 KB |
Output is correct |
39 |
Correct |
7 ms |
8020 KB |
Output is correct |
40 |
Correct |
30 ms |
31304 KB |
Output is correct |
41 |
Correct |
7 ms |
8020 KB |
Output is correct |
42 |
Correct |
32 ms |
31300 KB |
Output is correct |
43 |
Correct |
32 ms |
31316 KB |
Output is correct |
44 |
Correct |
0 ms |
340 KB |
Output is correct |
45 |
Correct |
379 ms |
310536 KB |
Output is correct |
46 |
Correct |
273 ms |
309864 KB |
Output is correct |
47 |
Correct |
400 ms |
310564 KB |
Output is correct |
48 |
Correct |
380 ms |
310496 KB |
Output is correct |
49 |
Correct |
192 ms |
309908 KB |
Output is correct |
50 |
Correct |
347 ms |
310504 KB |
Output is correct |
51 |
Correct |
386 ms |
310556 KB |
Output is correct |
52 |
Correct |
230 ms |
309992 KB |
Output is correct |
53 |
Correct |
193 ms |
309840 KB |
Output is correct |
54 |
Correct |
153 ms |
308172 KB |
Output is correct |
55 |
Correct |
346 ms |
310676 KB |
Output is correct |
56 |
Correct |
198 ms |
309720 KB |
Output is correct |
57 |
Correct |
220 ms |
310084 KB |
Output is correct |
58 |
Correct |
346 ms |
309772 KB |
Output is correct |
59 |
Correct |
197 ms |
309708 KB |
Output is correct |
60 |
Correct |
207 ms |
309648 KB |
Output is correct |
61 |
Correct |
342 ms |
309708 KB |
Output is correct |
62 |
Correct |
252 ms |
309708 KB |
Output is correct |
63 |
Correct |
303 ms |
309972 KB |
Output is correct |
64 |
Correct |
198 ms |
309732 KB |
Output is correct |
65 |
Correct |
358 ms |
310256 KB |
Output is correct |
66 |
Correct |
256 ms |
309752 KB |
Output is correct |
67 |
Correct |
297 ms |
309964 KB |
Output is correct |
68 |
Correct |
343 ms |
310140 KB |
Output is correct |
69 |
Correct |
355 ms |
310220 KB |
Output is correct |
70 |
Correct |
240 ms |
309768 KB |
Output is correct |
71 |
Correct |
331 ms |
310064 KB |
Output is correct |
72 |
Correct |
271 ms |
309940 KB |
Output is correct |
73 |
Correct |
356 ms |
310264 KB |
Output is correct |
74 |
Correct |
236 ms |
309656 KB |
Output is correct |
75 |
Correct |
161 ms |
155212 KB |
Output is correct |
76 |
Correct |
269 ms |
310004 KB |
Output is correct |
77 |
Correct |
368 ms |
310256 KB |
Output is correct |
78 |
Correct |
182 ms |
155384 KB |
Output is correct |
79 |
Correct |
153 ms |
155172 KB |
Output is correct |
80 |
Correct |
70 ms |
77720 KB |
Output is correct |
81 |
Correct |
184 ms |
155336 KB |
Output is correct |
82 |
Correct |
315 ms |
309892 KB |
Output is correct |
83 |
Correct |
72 ms |
77744 KB |
Output is correct |
84 |
Correct |
314 ms |
309768 KB |
Output is correct |