Submission #1016363

#TimeUsernameProblemLanguageResultExecution timeMemory
1016363May27_thBurza (COCI16_burza)C++17
0 / 160
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; #define i64 long long #define i128 __int128 #define mp make_pair #define pb push_back #define all(x) (x).begin(), (x).end() vector<int> G[500]; int f[500]; void dfs(int u, int par = -1) { vector<int> curval; for (auto v : G[u]) { if (v != par) { dfs(v, u); curval.pb(f[v]); } } sort(all(curval)); int sz = curval.size(); if (sz >= 2) f[u] = max(f[u], curval[sz - 2] + 1); } void Solve(void) { int N, K; cin >> N >> K; for (int i = 1; i <= N; i ++) f[i] = 0; for (int i = 1; i < N; i ++) { int u, v; cin >> u >> v; G[u].pb(v); G[v].pb(u); } dfs(1); cout << ((f[1] < K) ? "DA" : "NE"); } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(10); int Tests = 1; // cin >> Tests; while (Tests --) { 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...
#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...