Submission #994462

#TimeUsernameProblemLanguageResultExecution timeMemory
994462amine_arouaPolitical Development (BOI17_politicaldevelopment)C++17
16 / 100
213 ms306524 KiB
#include <bits/stdc++.h> //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") using namespace std; #define int long long #define pb push_back #define nl '\n' #define fore(i, y) for(int i = 0; i < y; i++) #define forr(i, x, y) for(int i = x;i<=y;i++) #define forn(i, y, x) for(int i = y; i >= x; i--) const int N = 50000; vector<bitset<N>> adj(N , 0); bool done[N]; int n , k; bitset<N> cur = 0; int maxClique(int i) { cur = adj[i]; int last = i; int cnt = 0; while(true) { cnt++; cur&=adj[last]; int before = last; for(int j = cur._Find_first() ; j < N ; j = cur._Find_next(i)) { if(done[j]) continue; last = j; break; } if(before == last) break; } return cnt; } signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>k; fore(i , n) { int d; cin>>d; fore(j , d) { int x; cin>>x; if(x != i) adj[i][x] = 1; } } int best = 0; fore(i , n) { best = max(best , maxClique(i)); done[i] = 1; } cout<<best<<nl; }
#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...