# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472546 | 2021-09-13T17:36:54 Z | ZaZo_ | Political Development (BOI17_politicaldevelopment) | C++14 | 1339 ms | 2220 KB |
#include <bits/stdc++.h> #define ZAZO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long using namespace std; vector<int>edges[50001]; int vis[50001]={0}; int mx=1,n,k; void dfs(int node , int cnt) { if(vis[node]) { mx=max(min(cnt,k),mx); return ; } vis[node] = 1; if(mx>k) return ; for(int i = 0 ; i < edges[node].size(); i ++) { dfs(edges[node][i],cnt+1); } } int32_t main() { ZAZO 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; edges[i].push_back(x); edges[x].push_back(i); } } for(int i = 0 ; i < n ; i ++) { dfs(i,0); memset(vis,0,sizeof vis); } cout<<mx<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1868 KB | Output is correct |
2 | Correct | 1 ms | 1868 KB | Output is correct |
3 | Correct | 1339 ms | 2132 KB | Output is correct |
4 | Correct | 900 ms | 2176 KB | Output is correct |
5 | Correct | 914 ms | 2180 KB | Output is correct |
6 | Correct | 973 ms | 2220 KB | Output is correct |
7 | Correct | 933 ms | 2212 KB | Output is correct |
8 | Correct | 67 ms | 1868 KB | Output is correct |
9 | Correct | 1 ms | 1868 KB | Output is correct |
10 | Correct | 71 ms | 1868 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1868 KB | Output is correct |
2 | Correct | 1 ms | 1868 KB | Output is correct |
3 | Correct | 1339 ms | 2132 KB | Output is correct |
4 | Correct | 900 ms | 2176 KB | Output is correct |
5 | Correct | 914 ms | 2180 KB | Output is correct |
6 | Correct | 973 ms | 2220 KB | Output is correct |
7 | Correct | 933 ms | 2212 KB | Output is correct |
8 | Correct | 67 ms | 1868 KB | Output is correct |
9 | Correct | 1 ms | 1868 KB | Output is correct |
10 | Correct | 71 ms | 1868 KB | Output is correct |
11 | Correct | 917 ms | 2184 KB | Output is correct |
12 | Incorrect | 955 ms | 2180 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 67 ms | 1868 KB | Output is correct |
2 | Incorrect | 2 ms | 1868 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1868 KB | Output is correct |
2 | Correct | 1 ms | 1868 KB | Output is correct |
3 | Correct | 1339 ms | 2132 KB | Output is correct |
4 | Correct | 900 ms | 2176 KB | Output is correct |
5 | Correct | 914 ms | 2180 KB | Output is correct |
6 | Correct | 973 ms | 2220 KB | Output is correct |
7 | Correct | 933 ms | 2212 KB | Output is correct |
8 | Correct | 67 ms | 1868 KB | Output is correct |
9 | Correct | 1 ms | 1868 KB | Output is correct |
10 | Correct | 71 ms | 1868 KB | Output is correct |
11 | Correct | 917 ms | 2184 KB | Output is correct |
12 | Incorrect | 955 ms | 2180 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1868 KB | Output is correct |
2 | Correct | 1 ms | 1868 KB | Output is correct |
3 | Correct | 1339 ms | 2132 KB | Output is correct |
4 | Correct | 900 ms | 2176 KB | Output is correct |
5 | Correct | 914 ms | 2180 KB | Output is correct |
6 | Correct | 973 ms | 2220 KB | Output is correct |
7 | Correct | 933 ms | 2212 KB | Output is correct |
8 | Correct | 67 ms | 1868 KB | Output is correct |
9 | Correct | 1 ms | 1868 KB | Output is correct |
10 | Correct | 71 ms | 1868 KB | Output is correct |
11 | Correct | 917 ms | 2184 KB | Output is correct |
12 | Incorrect | 955 ms | 2180 KB | Output isn't correct |
13 | Halted | 0 ms | 0 KB | - |