Submission #1306170

#TimeUsernameProblemLanguageResultExecution timeMemory
1306170Robert_juniorPolitical Development (BOI17_politicaldevelopment)C++20
16 / 100
224 ms4048 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<5010>
const int N = 5010, K = 1610;
const int mod = 998244353;
vector<int>g[N];
bt is[N];
void solve(){
	int n, k;
	cin>>n>>k;
	int ans = 1;
	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;
			g[i].pb(x);
		}
	}
	for(int i = 1; i <= n; i++){
		for(auto to : g[i]){
			if(is[i][to] && is[to][i]){
				ans = max(ans, 2ll);
				//cout<<i<<' '<<to<<'\n';
				for(int j = 1; j <= n; j++){
					if(j == i || j == to) continue;
					if(is[i][j] && is[j][i] && is[to][j] && is[j][to]){
						ans = max(ans, 3ll);
					}
				}
			}
		}
	}
	cout<<ans<<'\n';
}
main(){
	ios_base :: sync_with_stdio(false); 
	cin.tie(nullptr);
	int t = 1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Compilation message (stderr)

politicaldevelopment.cpp:46:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   46 | 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...