Submission #1035669

#TimeUsernameProblemLanguageResultExecution timeMemory
1035669vjudge1Political Development (BOI17_politicaldevelopment)C++17
100 / 100
564 ms335340 KiB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() const int N = 5e4; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, k, c, ans; vector<int> vt, adj[N]; set<int> st[N]; bitset<N> bt[N], r, toTake; void clean(int x) { for (int i = 0; i < n; i++) { if (adj[i].size()+1 < x) r[i] = 1; } } void dfs(int x) { c++; if (c > ans) { ans = c; clean(c+1); } vector<int> opt; for (int y = toTake._Find_first(); y < n; y = toTake._Find_next(y)) { if (r[y]) continue; opt.push_back(y); } int sz = opt.size(); if (!sz) return; int y = opt[rng() % sz]; toTake &= bt[y]; dfs(y); } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> k; for (int i = 0; i < n; i++) { int x; cin >> x; for (int j = 0; j < x; j++) { int y; cin >> y; st[i].insert(y); if (st[y].find(i) != st[y].end()) { bt[i][y] = 1; adj[i].push_back(y); bt[y][i] = 1; adj[y].push_back(i); } } } ans = 1; for (int i = 0; i < n*3; i++) { c = 0; toTake = bt[i%n]; dfs(i%n); } cout << ans << "\n"; }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'void clean(int)':
politicaldevelopment.cpp:19:25: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |     if (adj[i].size()+1 < x) r[i] = 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...