#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 INF = LONG_LONG_MAX;
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<5000> full;
deci(n);deci(k);
vector<bitset<5000>> arr(n);
for (int i = 0; i < n; ++i)
{
full[i]=1;
deci(y);
for (int j = 0; j < y; j++){
deci(x);
arr[i][x]=1;
}
}
bitset<5000> kk;
auto f = [&](bitset<5000> bs, int dept, auto f)->int{
if (dept==k) return 0;
int mava = 0;
int pos = bs._Find_first();
while (pos<5000){
if (bs[pos]==0) continue;
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:36:17: warning: overflow in conversion from 'long long int' to 'int' changes value from '9223372036854775807' to '-1' [-Woverflow]
36 | const int INF = LONG_LONG_MAX;
| ^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
4 ms |
3412 KB |
Output is correct |
4 |
Correct |
4 ms |
3412 KB |
Output is correct |
5 |
Correct |
4 ms |
3412 KB |
Output is correct |
6 |
Correct |
4 ms |
3412 KB |
Output is correct |
7 |
Correct |
4 ms |
3412 KB |
Output is correct |
8 |
Correct |
2 ms |
3412 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
3404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
4 ms |
3412 KB |
Output is correct |
4 |
Correct |
4 ms |
3412 KB |
Output is correct |
5 |
Correct |
4 ms |
3412 KB |
Output is correct |
6 |
Correct |
4 ms |
3412 KB |
Output is correct |
7 |
Correct |
4 ms |
3412 KB |
Output is correct |
8 |
Correct |
2 ms |
3412 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
3404 KB |
Output is correct |
11 |
Correct |
4 ms |
3412 KB |
Output is correct |
12 |
Correct |
5 ms |
3412 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
5 ms |
3412 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
5 ms |
3412 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
5 ms |
3412 KB |
Output is correct |
19 |
Correct |
2 ms |
3412 KB |
Output is correct |
20 |
Correct |
4 ms |
3412 KB |
Output is correct |
21 |
Correct |
4 ms |
3412 KB |
Output is correct |
22 |
Correct |
2 ms |
3412 KB |
Output is correct |
23 |
Correct |
5 ms |
3412 KB |
Output is correct |
24 |
Correct |
2 ms |
3412 KB |
Output is correct |
25 |
Correct |
5 ms |
3412 KB |
Output is correct |
26 |
Correct |
5 ms |
3412 KB |
Output is correct |
27 |
Correct |
5 ms |
3412 KB |
Output is correct |
28 |
Correct |
5 ms |
3412 KB |
Output is correct |
29 |
Correct |
5 ms |
3412 KB |
Output is correct |
30 |
Correct |
5 ms |
3412 KB |
Output is correct |
31 |
Correct |
6 ms |
3412 KB |
Output is correct |
32 |
Correct |
5 ms |
3412 KB |
Output is correct |
33 |
Correct |
5 ms |
3412 KB |
Output is correct |
34 |
Correct |
6 ms |
3412 KB |
Output is correct |
35 |
Correct |
3 ms |
1876 KB |
Output is correct |
36 |
Correct |
3 ms |
1876 KB |
Output is correct |
37 |
Correct |
3 ms |
1876 KB |
Output is correct |
38 |
Correct |
2 ms |
980 KB |
Output is correct |
39 |
Correct |
2 ms |
980 KB |
Output is correct |
40 |
Correct |
8 ms |
3412 KB |
Output is correct |
41 |
Correct |
2 ms |
980 KB |
Output is correct |
42 |
Correct |
7 ms |
3412 KB |
Output is correct |
43 |
Correct |
7 ms |
3412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3412 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Runtime error |
75 ms |
63124 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
4 ms |
3412 KB |
Output is correct |
4 |
Correct |
4 ms |
3412 KB |
Output is correct |
5 |
Correct |
4 ms |
3412 KB |
Output is correct |
6 |
Correct |
4 ms |
3412 KB |
Output is correct |
7 |
Correct |
4 ms |
3412 KB |
Output is correct |
8 |
Correct |
2 ms |
3412 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
3404 KB |
Output is correct |
11 |
Correct |
4 ms |
3412 KB |
Output is correct |
12 |
Correct |
5 ms |
3412 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
5 ms |
3412 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
5 ms |
3412 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
5 ms |
3412 KB |
Output is correct |
19 |
Correct |
2 ms |
3412 KB |
Output is correct |
20 |
Correct |
4 ms |
3412 KB |
Output is correct |
21 |
Correct |
4 ms |
3412 KB |
Output is correct |
22 |
Correct |
2 ms |
3412 KB |
Output is correct |
23 |
Correct |
5 ms |
3412 KB |
Output is correct |
24 |
Correct |
2 ms |
3412 KB |
Output is correct |
25 |
Correct |
5 ms |
3412 KB |
Output is correct |
26 |
Correct |
5 ms |
3412 KB |
Output is correct |
27 |
Correct |
5 ms |
3412 KB |
Output is correct |
28 |
Correct |
5 ms |
3412 KB |
Output is correct |
29 |
Correct |
5 ms |
3412 KB |
Output is correct |
30 |
Correct |
5 ms |
3412 KB |
Output is correct |
31 |
Correct |
6 ms |
3412 KB |
Output is correct |
32 |
Correct |
5 ms |
3412 KB |
Output is correct |
33 |
Correct |
5 ms |
3412 KB |
Output is correct |
34 |
Correct |
6 ms |
3412 KB |
Output is correct |
35 |
Correct |
3 ms |
1876 KB |
Output is correct |
36 |
Correct |
3 ms |
1876 KB |
Output is correct |
37 |
Correct |
3 ms |
1876 KB |
Output is correct |
38 |
Correct |
2 ms |
980 KB |
Output is correct |
39 |
Correct |
2 ms |
980 KB |
Output is correct |
40 |
Correct |
8 ms |
3412 KB |
Output is correct |
41 |
Correct |
2 ms |
980 KB |
Output is correct |
42 |
Correct |
7 ms |
3412 KB |
Output is correct |
43 |
Correct |
7 ms |
3412 KB |
Output is correct |
44 |
Execution timed out |
3059 ms |
3412 KB |
Time limit exceeded |
45 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
4 ms |
3412 KB |
Output is correct |
4 |
Correct |
4 ms |
3412 KB |
Output is correct |
5 |
Correct |
4 ms |
3412 KB |
Output is correct |
6 |
Correct |
4 ms |
3412 KB |
Output is correct |
7 |
Correct |
4 ms |
3412 KB |
Output is correct |
8 |
Correct |
2 ms |
3412 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
3404 KB |
Output is correct |
11 |
Correct |
4 ms |
3412 KB |
Output is correct |
12 |
Correct |
5 ms |
3412 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
5 ms |
3412 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
5 ms |
3412 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
5 ms |
3412 KB |
Output is correct |
19 |
Correct |
2 ms |
3412 KB |
Output is correct |
20 |
Correct |
4 ms |
3412 KB |
Output is correct |
21 |
Correct |
4 ms |
3412 KB |
Output is correct |
22 |
Correct |
2 ms |
3412 KB |
Output is correct |
23 |
Correct |
5 ms |
3412 KB |
Output is correct |
24 |
Correct |
2 ms |
3412 KB |
Output is correct |
25 |
Correct |
5 ms |
3412 KB |
Output is correct |
26 |
Correct |
5 ms |
3412 KB |
Output is correct |
27 |
Correct |
5 ms |
3412 KB |
Output is correct |
28 |
Correct |
5 ms |
3412 KB |
Output is correct |
29 |
Correct |
5 ms |
3412 KB |
Output is correct |
30 |
Correct |
5 ms |
3412 KB |
Output is correct |
31 |
Correct |
6 ms |
3412 KB |
Output is correct |
32 |
Correct |
5 ms |
3412 KB |
Output is correct |
33 |
Correct |
5 ms |
3412 KB |
Output is correct |
34 |
Correct |
6 ms |
3412 KB |
Output is correct |
35 |
Correct |
3 ms |
1876 KB |
Output is correct |
36 |
Correct |
3 ms |
1876 KB |
Output is correct |
37 |
Correct |
3 ms |
1876 KB |
Output is correct |
38 |
Correct |
2 ms |
980 KB |
Output is correct |
39 |
Correct |
2 ms |
980 KB |
Output is correct |
40 |
Correct |
8 ms |
3412 KB |
Output is correct |
41 |
Correct |
2 ms |
980 KB |
Output is correct |
42 |
Correct |
7 ms |
3412 KB |
Output is correct |
43 |
Correct |
7 ms |
3412 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Runtime error |
65 ms |
63064 KB |
Execution killed with signal 11 |
46 |
Halted |
0 ms |
0 KB |
- |