#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){
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 |
28 ms |
31296 KB |
Output is correct |
4 |
Correct |
26 ms |
31280 KB |
Output is correct |
5 |
Correct |
26 ms |
31248 KB |
Output is correct |
6 |
Correct |
27 ms |
31288 KB |
Output is correct |
7 |
Correct |
33 ms |
31332 KB |
Output is correct |
8 |
Correct |
18 ms |
31060 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
18 ms |
31112 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 |
28 ms |
31296 KB |
Output is correct |
4 |
Correct |
26 ms |
31280 KB |
Output is correct |
5 |
Correct |
26 ms |
31248 KB |
Output is correct |
6 |
Correct |
27 ms |
31288 KB |
Output is correct |
7 |
Correct |
33 ms |
31332 KB |
Output is correct |
8 |
Correct |
18 ms |
31060 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
18 ms |
31112 KB |
Output is correct |
11 |
Correct |
25 ms |
31312 KB |
Output is correct |
12 |
Correct |
31 ms |
31284 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
31 ms |
31292 KB |
Output is correct |
15 |
Correct |
0 ms |
340 KB |
Output is correct |
16 |
Correct |
36 ms |
31316 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
33 ms |
31316 KB |
Output is correct |
19 |
Correct |
18 ms |
31052 KB |
Output is correct |
20 |
Correct |
27 ms |
31300 KB |
Output is correct |
21 |
Correct |
28 ms |
31316 KB |
Output is correct |
22 |
Correct |
20 ms |
31148 KB |
Output is correct |
23 |
Correct |
37 ms |
31316 KB |
Output is correct |
24 |
Correct |
18 ms |
31060 KB |
Output is correct |
25 |
Correct |
37 ms |
31316 KB |
Output is correct |
26 |
Correct |
35 ms |
31224 KB |
Output is correct |
27 |
Correct |
41 ms |
31324 KB |
Output is correct |
28 |
Correct |
35 ms |
31316 KB |
Output is correct |
29 |
Correct |
33 ms |
31316 KB |
Output is correct |
30 |
Correct |
37 ms |
31316 KB |
Output is correct |
31 |
Correct |
37 ms |
31316 KB |
Output is correct |
32 |
Correct |
37 ms |
31316 KB |
Output is correct |
33 |
Correct |
42 ms |
31356 KB |
Output is correct |
34 |
Correct |
39 ms |
31316 KB |
Output is correct |
35 |
Correct |
18 ms |
15828 KB |
Output is correct |
36 |
Correct |
22 ms |
15792 KB |
Output is correct |
37 |
Correct |
18 ms |
15828 KB |
Output is correct |
38 |
Correct |
9 ms |
7968 KB |
Output is correct |
39 |
Correct |
9 ms |
8020 KB |
Output is correct |
40 |
Correct |
44 ms |
31332 KB |
Output is correct |
41 |
Correct |
10 ms |
8020 KB |
Output is correct |
42 |
Correct |
44 ms |
31280 KB |
Output is correct |
43 |
Correct |
45 ms |
31316 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 |
480 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Correct |
870 ms |
312116 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1813 ms |
312156 KB |
Output is correct |
14 |
Correct |
1 ms |
468 KB |
Output is correct |
15 |
Correct |
852 ms |
312016 KB |
Output is correct |
16 |
Correct |
995 ms |
312156 KB |
Output is correct |
17 |
Correct |
1883 ms |
312160 KB |
Output is correct |
18 |
Correct |
978 ms |
312268 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 |
28 ms |
31296 KB |
Output is correct |
4 |
Correct |
26 ms |
31280 KB |
Output is correct |
5 |
Correct |
26 ms |
31248 KB |
Output is correct |
6 |
Correct |
27 ms |
31288 KB |
Output is correct |
7 |
Correct |
33 ms |
31332 KB |
Output is correct |
8 |
Correct |
18 ms |
31060 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
18 ms |
31112 KB |
Output is correct |
11 |
Correct |
25 ms |
31312 KB |
Output is correct |
12 |
Correct |
31 ms |
31284 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
31 ms |
31292 KB |
Output is correct |
15 |
Correct |
0 ms |
340 KB |
Output is correct |
16 |
Correct |
36 ms |
31316 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
33 ms |
31316 KB |
Output is correct |
19 |
Correct |
18 ms |
31052 KB |
Output is correct |
20 |
Correct |
27 ms |
31300 KB |
Output is correct |
21 |
Correct |
28 ms |
31316 KB |
Output is correct |
22 |
Correct |
20 ms |
31148 KB |
Output is correct |
23 |
Correct |
37 ms |
31316 KB |
Output is correct |
24 |
Correct |
18 ms |
31060 KB |
Output is correct |
25 |
Correct |
37 ms |
31316 KB |
Output is correct |
26 |
Correct |
35 ms |
31224 KB |
Output is correct |
27 |
Correct |
41 ms |
31324 KB |
Output is correct |
28 |
Correct |
35 ms |
31316 KB |
Output is correct |
29 |
Correct |
33 ms |
31316 KB |
Output is correct |
30 |
Correct |
37 ms |
31316 KB |
Output is correct |
31 |
Correct |
37 ms |
31316 KB |
Output is correct |
32 |
Correct |
37 ms |
31316 KB |
Output is correct |
33 |
Correct |
42 ms |
31356 KB |
Output is correct |
34 |
Correct |
39 ms |
31316 KB |
Output is correct |
35 |
Correct |
18 ms |
15828 KB |
Output is correct |
36 |
Correct |
22 ms |
15792 KB |
Output is correct |
37 |
Correct |
18 ms |
15828 KB |
Output is correct |
38 |
Correct |
9 ms |
7968 KB |
Output is correct |
39 |
Correct |
9 ms |
8020 KB |
Output is correct |
40 |
Correct |
44 ms |
31332 KB |
Output is correct |
41 |
Correct |
10 ms |
8020 KB |
Output is correct |
42 |
Correct |
44 ms |
31280 KB |
Output is correct |
43 |
Correct |
45 ms |
31316 KB |
Output is correct |
44 |
Execution timed out |
3058 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 |
28 ms |
31296 KB |
Output is correct |
4 |
Correct |
26 ms |
31280 KB |
Output is correct |
5 |
Correct |
26 ms |
31248 KB |
Output is correct |
6 |
Correct |
27 ms |
31288 KB |
Output is correct |
7 |
Correct |
33 ms |
31332 KB |
Output is correct |
8 |
Correct |
18 ms |
31060 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
18 ms |
31112 KB |
Output is correct |
11 |
Correct |
25 ms |
31312 KB |
Output is correct |
12 |
Correct |
31 ms |
31284 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
31 ms |
31292 KB |
Output is correct |
15 |
Correct |
0 ms |
340 KB |
Output is correct |
16 |
Correct |
36 ms |
31316 KB |
Output is correct |
17 |
Correct |
0 ms |
340 KB |
Output is correct |
18 |
Correct |
33 ms |
31316 KB |
Output is correct |
19 |
Correct |
18 ms |
31052 KB |
Output is correct |
20 |
Correct |
27 ms |
31300 KB |
Output is correct |
21 |
Correct |
28 ms |
31316 KB |
Output is correct |
22 |
Correct |
20 ms |
31148 KB |
Output is correct |
23 |
Correct |
37 ms |
31316 KB |
Output is correct |
24 |
Correct |
18 ms |
31060 KB |
Output is correct |
25 |
Correct |
37 ms |
31316 KB |
Output is correct |
26 |
Correct |
35 ms |
31224 KB |
Output is correct |
27 |
Correct |
41 ms |
31324 KB |
Output is correct |
28 |
Correct |
35 ms |
31316 KB |
Output is correct |
29 |
Correct |
33 ms |
31316 KB |
Output is correct |
30 |
Correct |
37 ms |
31316 KB |
Output is correct |
31 |
Correct |
37 ms |
31316 KB |
Output is correct |
32 |
Correct |
37 ms |
31316 KB |
Output is correct |
33 |
Correct |
42 ms |
31356 KB |
Output is correct |
34 |
Correct |
39 ms |
31316 KB |
Output is correct |
35 |
Correct |
18 ms |
15828 KB |
Output is correct |
36 |
Correct |
22 ms |
15792 KB |
Output is correct |
37 |
Correct |
18 ms |
15828 KB |
Output is correct |
38 |
Correct |
9 ms |
7968 KB |
Output is correct |
39 |
Correct |
9 ms |
8020 KB |
Output is correct |
40 |
Correct |
44 ms |
31332 KB |
Output is correct |
41 |
Correct |
10 ms |
8020 KB |
Output is correct |
42 |
Correct |
44 ms |
31280 KB |
Output is correct |
43 |
Correct |
45 ms |
31316 KB |
Output is correct |
44 |
Correct |
1 ms |
384 KB |
Output is correct |
45 |
Correct |
624 ms |
310552 KB |
Output is correct |
46 |
Correct |
436 ms |
309872 KB |
Output is correct |
47 |
Correct |
627 ms |
310568 KB |
Output is correct |
48 |
Correct |
631 ms |
310548 KB |
Output is correct |
49 |
Correct |
236 ms |
310004 KB |
Output is correct |
50 |
Correct |
618 ms |
310496 KB |
Output is correct |
51 |
Correct |
633 ms |
310560 KB |
Output is correct |
52 |
Correct |
300 ms |
309960 KB |
Output is correct |
53 |
Correct |
225 ms |
309848 KB |
Output is correct |
54 |
Correct |
153 ms |
308172 KB |
Output is correct |
55 |
Correct |
622 ms |
310684 KB |
Output is correct |
56 |
Correct |
275 ms |
309672 KB |
Output is correct |
57 |
Correct |
301 ms |
310088 KB |
Output is correct |
58 |
Correct |
987 ms |
309768 KB |
Output is correct |
59 |
Correct |
251 ms |
309704 KB |
Output is correct |
60 |
Correct |
249 ms |
309776 KB |
Output is correct |
61 |
Correct |
990 ms |
309792 KB |
Output is correct |
62 |
Correct |
429 ms |
309776 KB |
Output is correct |
63 |
Correct |
479 ms |
309876 KB |
Output is correct |
64 |
Correct |
248 ms |
309720 KB |
Output is correct |
65 |
Correct |
703 ms |
310196 KB |
Output is correct |
66 |
Correct |
434 ms |
309768 KB |
Output is correct |
67 |
Correct |
551 ms |
309984 KB |
Output is correct |
68 |
Correct |
533 ms |
310140 KB |
Output is correct |
69 |
Correct |
695 ms |
310204 KB |
Output is correct |
70 |
Correct |
327 ms |
309692 KB |
Output is correct |
71 |
Correct |
538 ms |
310248 KB |
Output is correct |
72 |
Correct |
406 ms |
309860 KB |
Output is correct |
73 |
Correct |
587 ms |
310272 KB |
Output is correct |
74 |
Correct |
325 ms |
309780 KB |
Output is correct |
75 |
Correct |
271 ms |
155176 KB |
Output is correct |
76 |
Correct |
403 ms |
310052 KB |
Output is correct |
77 |
Correct |
580 ms |
310272 KB |
Output is correct |
78 |
Correct |
276 ms |
155340 KB |
Output is correct |
79 |
Correct |
242 ms |
155324 KB |
Output is correct |
80 |
Correct |
108 ms |
77752 KB |
Output is correct |
81 |
Correct |
279 ms |
155340 KB |
Output is correct |
82 |
Correct |
485 ms |
309848 KB |
Output is correct |
83 |
Correct |
108 ms |
77764 KB |
Output is correct |
84 |
Correct |
481 ms |
309708 KB |
Output is correct |