Submission #785025

#TimeUsernameProblemLanguageResultExecution timeMemory
785025tolbiPolitical Development (BOI17_politicaldevelopment)C++17
100 / 100
513 ms312296 KiB
#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 (stderr)

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++){
      |                    ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...