# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
472476 | 2021-09-13T15:56:20 Z | yasseenkamel | Political Development (BOI17_politicaldevelopment) | C++14 | 3 ms | 332 KB |
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize("-Ofast") #include <bits/stdc++.h> using namespace std; typedef int in; #define int long long #define s second #define f first const long double EPS=1e-9; const int MOD=1e9+7; const int N=1e6; int n,m; vector<int> adj[5005]; bool vis[5005]; int ans = 1; void dfs(int node,int d){ if(vis[node]){ if(d == 3){ ans = max(ans,d); } else if(d == 2){ ans = max(ans,d); } return; } if(d > m){ return; } vis[node] = 1; for(int i = 0 ; i < adj[node].size() ; i ++){ dfs(adj[node][i],d + 1); } } in main(){ cin >> n >> m; for(int i = 0 ; i < n ; i ++){ int x; cin >> x; while(x --){ int y; cin >> y; adj[x].push_back(y); } } for(int i = 0 ; i < n ; i ++){ memset(vis,0,sizeof vis); dfs(i,1); } cout << ans << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 0 ms | 332 KB | Output is correct |
5 | Incorrect | 0 ms | 332 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |