답안 #472534

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472534 2021-09-13T17:17:45 Z ZaZo_ Political Development (BOI17_politicaldevelopment) C++14
0 / 100
983 ms 2212 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=0,n,k;
void dfs(int node , int cnt)
{
  mx=max(min(cnt,k),mx);
  vis[node] = 1;
  for(int i = 0 ; i < edges[node].size(); i ++)
  {
    if(!vis[edges[node][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

politicaldevelopment.cpp: In function 'void dfs(long long int, long long int)':
politicaldevelopment.cpp:12:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for(int i = 0 ; i < edges[node].size(); i ++)
      |                   ~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1868 KB Output is correct
2 Correct 2 ms 1868 KB Output is correct
3 Correct 983 ms 2128 KB Output is correct
4 Correct 582 ms 2180 KB Output is correct
5 Correct 584 ms 2180 KB Output is correct
6 Correct 606 ms 2124 KB Output is correct
7 Correct 607 ms 2212 KB Output is correct
8 Incorrect 70 ms 1868 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1868 KB Output is correct
2 Correct 2 ms 1868 KB Output is correct
3 Correct 983 ms 2128 KB Output is correct
4 Correct 582 ms 2180 KB Output is correct
5 Correct 584 ms 2180 KB Output is correct
6 Correct 606 ms 2124 KB Output is correct
7 Correct 607 ms 2212 KB Output is correct
8 Incorrect 70 ms 1868 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 67 ms 1868 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1868 KB Output is correct
2 Correct 2 ms 1868 KB Output is correct
3 Correct 983 ms 2128 KB Output is correct
4 Correct 582 ms 2180 KB Output is correct
5 Correct 584 ms 2180 KB Output is correct
6 Correct 606 ms 2124 KB Output is correct
7 Correct 607 ms 2212 KB Output is correct
8 Incorrect 70 ms 1868 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1868 KB Output is correct
2 Correct 2 ms 1868 KB Output is correct
3 Correct 983 ms 2128 KB Output is correct
4 Correct 582 ms 2180 KB Output is correct
5 Correct 584 ms 2180 KB Output is correct
6 Correct 606 ms 2124 KB Output is correct
7 Correct 607 ms 2212 KB Output is correct
8 Incorrect 70 ms 1868 KB Output isn't correct
9 Halted 0 ms 0 KB -