#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;
int pos = bs._Find_first();
while (pos<50000){
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 |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
25 ms |
31316 KB |
Output is correct |
4 |
Correct |
24 ms |
31324 KB |
Output is correct |
5 |
Correct |
24 ms |
31288 KB |
Output is correct |
6 |
Correct |
24 ms |
31316 KB |
Output is correct |
7 |
Correct |
29 ms |
31364 KB |
Output is correct |
8 |
Correct |
17 ms |
31060 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
17 ms |
31080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
25 ms |
31316 KB |
Output is correct |
4 |
Correct |
24 ms |
31324 KB |
Output is correct |
5 |
Correct |
24 ms |
31288 KB |
Output is correct |
6 |
Correct |
24 ms |
31316 KB |
Output is correct |
7 |
Correct |
29 ms |
31364 KB |
Output is correct |
8 |
Correct |
17 ms |
31060 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
17 ms |
31080 KB |
Output is correct |
11 |
Correct |
24 ms |
31284 KB |
Output is correct |
12 |
Correct |
27 ms |
31316 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
33 ms |
31316 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
27 ms |
31372 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
28 ms |
31316 KB |
Output is correct |
19 |
Correct |
17 ms |
31060 KB |
Output is correct |
20 |
Correct |
25 ms |
31296 KB |
Output is correct |
21 |
Correct |
25 ms |
31316 KB |
Output is correct |
22 |
Correct |
17 ms |
31156 KB |
Output is correct |
23 |
Correct |
33 ms |
31212 KB |
Output is correct |
24 |
Correct |
18 ms |
31060 KB |
Output is correct |
25 |
Correct |
33 ms |
31316 KB |
Output is correct |
26 |
Correct |
32 ms |
31316 KB |
Output is correct |
27 |
Correct |
29 ms |
31316 KB |
Output is correct |
28 |
Correct |
33 ms |
31232 KB |
Output is correct |
29 |
Correct |
30 ms |
31320 KB |
Output is correct |
30 |
Correct |
32 ms |
31316 KB |
Output is correct |
31 |
Correct |
33 ms |
31316 KB |
Output is correct |
32 |
Correct |
34 ms |
31316 KB |
Output is correct |
33 |
Correct |
39 ms |
31328 KB |
Output is correct |
34 |
Correct |
33 ms |
31316 KB |
Output is correct |
35 |
Correct |
16 ms |
15828 KB |
Output is correct |
36 |
Correct |
15 ms |
15828 KB |
Output is correct |
37 |
Correct |
15 ms |
15828 KB |
Output is correct |
38 |
Correct |
8 ms |
8020 KB |
Output is correct |
39 |
Correct |
8 ms |
8020 KB |
Output is correct |
40 |
Correct |
38 ms |
31316 KB |
Output is correct |
41 |
Correct |
8 ms |
8020 KB |
Output is correct |
42 |
Correct |
38 ms |
31316 KB |
Output is correct |
43 |
Correct |
39 ms |
31292 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 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 |
0 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 |
757 ms |
312120 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1535 ms |
314764 KB |
Output is correct |
14 |
Correct |
1 ms |
468 KB |
Output is correct |
15 |
Correct |
740 ms |
314768 KB |
Output is correct |
16 |
Correct |
828 ms |
314880 KB |
Output is correct |
17 |
Correct |
1514 ms |
314920 KB |
Output is correct |
18 |
Correct |
818 ms |
314804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
25 ms |
31316 KB |
Output is correct |
4 |
Correct |
24 ms |
31324 KB |
Output is correct |
5 |
Correct |
24 ms |
31288 KB |
Output is correct |
6 |
Correct |
24 ms |
31316 KB |
Output is correct |
7 |
Correct |
29 ms |
31364 KB |
Output is correct |
8 |
Correct |
17 ms |
31060 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
17 ms |
31080 KB |
Output is correct |
11 |
Correct |
24 ms |
31284 KB |
Output is correct |
12 |
Correct |
27 ms |
31316 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
33 ms |
31316 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
27 ms |
31372 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
28 ms |
31316 KB |
Output is correct |
19 |
Correct |
17 ms |
31060 KB |
Output is correct |
20 |
Correct |
25 ms |
31296 KB |
Output is correct |
21 |
Correct |
25 ms |
31316 KB |
Output is correct |
22 |
Correct |
17 ms |
31156 KB |
Output is correct |
23 |
Correct |
33 ms |
31212 KB |
Output is correct |
24 |
Correct |
18 ms |
31060 KB |
Output is correct |
25 |
Correct |
33 ms |
31316 KB |
Output is correct |
26 |
Correct |
32 ms |
31316 KB |
Output is correct |
27 |
Correct |
29 ms |
31316 KB |
Output is correct |
28 |
Correct |
33 ms |
31232 KB |
Output is correct |
29 |
Correct |
30 ms |
31320 KB |
Output is correct |
30 |
Correct |
32 ms |
31316 KB |
Output is correct |
31 |
Correct |
33 ms |
31316 KB |
Output is correct |
32 |
Correct |
34 ms |
31316 KB |
Output is correct |
33 |
Correct |
39 ms |
31328 KB |
Output is correct |
34 |
Correct |
33 ms |
31316 KB |
Output is correct |
35 |
Correct |
16 ms |
15828 KB |
Output is correct |
36 |
Correct |
15 ms |
15828 KB |
Output is correct |
37 |
Correct |
15 ms |
15828 KB |
Output is correct |
38 |
Correct |
8 ms |
8020 KB |
Output is correct |
39 |
Correct |
8 ms |
8020 KB |
Output is correct |
40 |
Correct |
38 ms |
31316 KB |
Output is correct |
41 |
Correct |
8 ms |
8020 KB |
Output is correct |
42 |
Correct |
38 ms |
31316 KB |
Output is correct |
43 |
Correct |
39 ms |
31292 KB |
Output is correct |
44 |
Execution timed out |
3077 ms |
31444 KB |
Time limit exceeded |
45 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
25 ms |
31316 KB |
Output is correct |
4 |
Correct |
24 ms |
31324 KB |
Output is correct |
5 |
Correct |
24 ms |
31288 KB |
Output is correct |
6 |
Correct |
24 ms |
31316 KB |
Output is correct |
7 |
Correct |
29 ms |
31364 KB |
Output is correct |
8 |
Correct |
17 ms |
31060 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
17 ms |
31080 KB |
Output is correct |
11 |
Correct |
24 ms |
31284 KB |
Output is correct |
12 |
Correct |
27 ms |
31316 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
33 ms |
31316 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
27 ms |
31372 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
28 ms |
31316 KB |
Output is correct |
19 |
Correct |
17 ms |
31060 KB |
Output is correct |
20 |
Correct |
25 ms |
31296 KB |
Output is correct |
21 |
Correct |
25 ms |
31316 KB |
Output is correct |
22 |
Correct |
17 ms |
31156 KB |
Output is correct |
23 |
Correct |
33 ms |
31212 KB |
Output is correct |
24 |
Correct |
18 ms |
31060 KB |
Output is correct |
25 |
Correct |
33 ms |
31316 KB |
Output is correct |
26 |
Correct |
32 ms |
31316 KB |
Output is correct |
27 |
Correct |
29 ms |
31316 KB |
Output is correct |
28 |
Correct |
33 ms |
31232 KB |
Output is correct |
29 |
Correct |
30 ms |
31320 KB |
Output is correct |
30 |
Correct |
32 ms |
31316 KB |
Output is correct |
31 |
Correct |
33 ms |
31316 KB |
Output is correct |
32 |
Correct |
34 ms |
31316 KB |
Output is correct |
33 |
Correct |
39 ms |
31328 KB |
Output is correct |
34 |
Correct |
33 ms |
31316 KB |
Output is correct |
35 |
Correct |
16 ms |
15828 KB |
Output is correct |
36 |
Correct |
15 ms |
15828 KB |
Output is correct |
37 |
Correct |
15 ms |
15828 KB |
Output is correct |
38 |
Correct |
8 ms |
8020 KB |
Output is correct |
39 |
Correct |
8 ms |
8020 KB |
Output is correct |
40 |
Correct |
38 ms |
31316 KB |
Output is correct |
41 |
Correct |
8 ms |
8020 KB |
Output is correct |
42 |
Correct |
38 ms |
31316 KB |
Output is correct |
43 |
Correct |
39 ms |
31292 KB |
Output is correct |
44 |
Correct |
1 ms |
340 KB |
Output is correct |
45 |
Correct |
541 ms |
310548 KB |
Output is correct |
46 |
Correct |
378 ms |
310696 KB |
Output is correct |
47 |
Correct |
547 ms |
312372 KB |
Output is correct |
48 |
Correct |
582 ms |
312352 KB |
Output is correct |
49 |
Correct |
224 ms |
310568 KB |
Output is correct |
50 |
Correct |
502 ms |
312956 KB |
Output is correct |
51 |
Correct |
539 ms |
312288 KB |
Output is correct |
52 |
Correct |
264 ms |
310732 KB |
Output is correct |
53 |
Correct |
204 ms |
310656 KB |
Output is correct |
54 |
Correct |
144 ms |
308204 KB |
Output is correct |
55 |
Correct |
545 ms |
313044 KB |
Output is correct |
56 |
Correct |
219 ms |
310092 KB |
Output is correct |
57 |
Correct |
263 ms |
310648 KB |
Output is correct |
58 |
Correct |
880 ms |
310732 KB |
Output is correct |
59 |
Correct |
222 ms |
310092 KB |
Output is correct |
60 |
Correct |
220 ms |
310036 KB |
Output is correct |
61 |
Correct |
836 ms |
310728 KB |
Output is correct |
62 |
Correct |
367 ms |
310516 KB |
Output is correct |
63 |
Correct |
398 ms |
310984 KB |
Output is correct |
64 |
Correct |
219 ms |
310160 KB |
Output is correct |
65 |
Correct |
560 ms |
311576 KB |
Output is correct |
66 |
Correct |
370 ms |
310440 KB |
Output is correct |
67 |
Correct |
397 ms |
311072 KB |
Output is correct |
68 |
Correct |
458 ms |
311436 KB |
Output is correct |
69 |
Correct |
570 ms |
311576 KB |
Output is correct |
70 |
Correct |
293 ms |
310344 KB |
Output is correct |
71 |
Correct |
450 ms |
311444 KB |
Output is correct |
72 |
Correct |
352 ms |
311012 KB |
Output is correct |
73 |
Correct |
489 ms |
311816 KB |
Output is correct |
74 |
Correct |
290 ms |
310360 KB |
Output is correct |
75 |
Correct |
213 ms |
155684 KB |
Output is correct |
76 |
Correct |
350 ms |
311104 KB |
Output is correct |
77 |
Correct |
489 ms |
311828 KB |
Output is correct |
78 |
Correct |
267 ms |
156140 KB |
Output is correct |
79 |
Correct |
206 ms |
155640 KB |
Output is correct |
80 |
Correct |
96 ms |
78032 KB |
Output is correct |
81 |
Correct |
257 ms |
156128 KB |
Output is correct |
82 |
Correct |
439 ms |
310956 KB |
Output is correct |
83 |
Correct |
92 ms |
78000 KB |
Output is correct |
84 |
Correct |
479 ms |
311008 KB |
Output is correct |