제출 #1306191

#제출 시각아이디문제언어결과실행 시간메모리
1306191mukhamediyarPolitical Development (BOI17_politicaldevelopment)C++20
0 / 100
6 ms840 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define int long long #define F first #define S second const int N = 1e6 + 7; const int inf = 1e18; const int mod = 1e9 + 7; int cost[N]; vector<int>a[N]; int ok = 0; void dfs(int v,int p){ for(auto u: a[v]){ if(u == p){ ok= 1; return; } dfs(u,v); } } void solve(){ //freopen("bridges.in", "r", stdin); //freopen("bridges.out", "w", stdout); int n,k; cin >> n >> k; for(int i = 0; i < n; i ++){ int d; cin >>d; for(int j = 0; j < d; j ++){ int x; cin >> x; a[i].pb(x); } } dfs(1,0); if(ok){ cout << 2 << "\n"; } else{ cout << 1 << "\n"; } } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int t = 1; //cin >> t; while(t --){ solve(); } }
#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...