Submission #1128418

#TimeUsernameProblemLanguageResultExecution timeMemory
1128418KasymKPolitical Development (BOI17_politicaldevelopment)C++20
0 / 100
28 ms20292 KiB
// I want to go high as fuck tonight... // Music name => (Gyzyl Ysyk) // Authors: A$OK, SazYelme, Swizzy347 and Ma.Gallery // Hash your favorite words. #include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int N = 5e4+5; bitset<N> adj[N]; int answer, n; void dfs(bitset<N> vis, int mal){ while(1){ // bool did=0; // for(auto i : vis) // did|=i; // if(!did) // break; if(!vis.any()) break; // int id=n; // for(int i = n-1; i >= 0; --i) // if(vis[i]){ // vis[i]=0; // id=i; // break; // } int id=vis._Find_first(); vis[id]=0; // vector<bool> is(n, false); bitset<N> is=vis&adj[id]; int cnt=is.count(); // for(int i = 0; i < n; ++i) // if(vis[i] and adj[id][i]) // is[i]=1; // int cnt=0; // for(int i = 0; i < n; ++i) // cnt+=is[i]; if(umax(answer, cnt+mal+1)) dfs(is, mal+1); } } int main(){ int k; scanf("%d%d", &n, &k); for(int i = 0; i < n; ++i){ int x, ad; scanf("%d", &x); adj[i][i]=1; while(x--) scanf("%d", &ad), adj[i][ad]=1; } bitset<N> vis; for(int i = 0; i < n; ++i) vis.set(i); dfs(vis, 0); printf("%d\n", answer); return 0; }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:58:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~
politicaldevelopment.cpp:61:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
politicaldevelopment.cpp:64:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   64 |             scanf("%d", &ad), adj[i][ad]=1;
      |             ~~~~~^~~~~~~~~~~
#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...