Submission #1306234

#TimeUsernameProblemLanguageResultExecution timeMemory
1306234thecrazycandyPolitical Development (BOI17_politicaldevelopment)C++20
0 / 100
3050 ms577144 KiB
#include <bits/stdc++.h> //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") using namespace std; #define ll long long #define sped_up ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define rall(v) (v).rbegin(), (v).rend() #define all(v) (v).begin(), (v).end() #define pb push_back #define S second #define F first const ll INF = (ll)1e9 + 1, INFL = (ll)1e18 + 1; const ll mod = (ll)1e9 + 7, MAXN = (ll)5e3 + 1; vector <ll> g[MAXN]; bool c[MAXN][MAXN]; bool used[MAXN]; ll col = 0; void dfs (ll v) { bool ok = 0; used[v] = 1; for (int i = 1; i <= col; i++) ok |= c[i][v]; if (!ok) col++; for (int i = 1; i <= col; i++) { if (c[i][v]) for (auto j : g[v]) c[i][j] = 0, cout << i << ' ' << v << ' ' << j << '\n'; } for (auto i : g[v]) if (!used[i]) dfs(i); for (int i = 1; i <= col; i++) { if (c[i][v]) for (auto j : g[v]) c[i][j] = 0; } } int main() { sped_up; ll n, k; cin >> n >> k; ll mx = 0; for (int i = 1; i <= n; i++) { ll a; cin >> a; while (a--) { ll b; cin >> b; c[i][b + 1] = 1; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i != j && !c[i][j]) g[i].pb(j); c[i][j] = 1; } } dfs(1); for (int i = 1; i <= col; i++) { ll cnt = 0; for (int j = 1; j <= n; j++) cnt += c[i][j]; mx = max(mx, cnt); } cout << mx; }
#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...