## Submission #96732

# Submission time Handle Problem Language Result Execution time Memory
96732 2019-02-11T15:23:05 Z tieunhi Burza (COCI16_burza) C++14
0 / 160
3 ms 504 KB
```#include <bits/stdc++.h>
#define FOR(i, u, v) for (int i = u; i <= v; i++)
#define FORD(i, v, u) for (int i = v; i >= u; i--)
#define ll long long
#define pill pair<int, ll>
#define PB push_back
#define mp make_pair
#define F first
#define S second
#define N 500
#define maxc 1000000007
#define mid (r + l)/2

using namespace std;

int n, k, dp[N], h[N];
vector<int> a[N];
void DFS(int u, int p)
{
if (h[u] == k)
{
dp[u] = 1;
return;
}
int f1 = 0, f2 = 0;
for (auto v : a[u])
{
if (v == p) continue;
h[v] = h[u] + 1;
DFS(v, u);
if (dp[v] >= f1)
f2 = f1, f1 = dp[v];
else if (dp[v] > f2)
f2 = dp[v];
}
if (f1 == 0 && f2 == 0) dp[u] = -1;
else dp[u] = f2 + 1;
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen("INP.TXT", "r", stdin);
cin >> n >> k;
FOR(i, 2, n)
{
int u, v; cin >> u >> v;
a[u].PB(v);
a[v].PB(u);
}
DFS(1, -1);
if (dp[1] <= k) cout <<"DA";
else cout <<"NE";
}
```

#### Subtask #1 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #2 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #3 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #4 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #5 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #6 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #7 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #8 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #9 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #10 0 / 16.0

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -