Submission #1306204

#TimeUsernameProblemLanguageResultExecution timeMemory
1306204Robert_juniorPolitical Development (BOI17_politicaldevelopment)C++20
16 / 100
3093 ms589824 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ll long long #define all(x) x.begin(), x.end() #define ins insert #define pb push_back #define F first #define S second #define bt bitset<50010> const int N = 50010, K = 1610; const int mod = 998244353; vector<int>g[N], gg[N]; bt is[N], b[N]; int ans = 1; vector<int>V; bool used[N]; void dfs(int v){ used[v] = 1; V.pb(v); ans = max(ans, (int)(V.size())); for(auto to : g[v]){ bool ok = 1; for(auto it : V){ if(!b[it][to]){ ok = 0; break; } } if(ok){ dfs(to); } } used[v] = 0; V.pop_back(); } void solve(){ int n, k; cin>>n>>k; for(int i = 1; i <= n; i++){ int m; cin>>m; for(int j = 1; j <= m; j++){ int x; cin>>x; x++; is[i][x] = 1; gg[i].pb(x); } } for(int i = 1; i <= n; i++){ for(auto to : gg[i]){ if(is[i][to] && is[to][i]){ g[i].pb(to); g[to].pb(i); b[i][to] = 1; b[to][i] = 1; } } } for(int i = 1; i <= n; i++){ dfs(i); } cout<<ans; } main(){ ios_base :: sync_with_stdio(false); cin.tie(nullptr); int t = 1; //cin>>t; while(t--){ solve(); } }

Compilation message (stderr)

politicaldevelopment.cpp:66:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   66 | main(){
      | ^~~~
#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...