Submission #102317

#TimeUsernameProblemLanguageResultExecution timeMemory
102317SirCenessBurza (COCI16_burza)C++14
0 / 160
3 ms384 KiB
#include <bits/stdc++.h> #define mod 1000000007 typedef long long ll; using namespace std; int n, m; list<int> adj[400]; multiset<int> sets[400]; int f(int ata, int node){ //cout << "f(" << ata << ", " << node << ")\n"; for (list<int>::iterator it = adj[node].begin(); it != adj[node].end(); ++it){ if ((*it) == ata) continue; sets[node].insert(f(node, *it)); } if (sets[node].size() < 2) return 0; multiset<int>::iterator it = sets[node].end(); advance(it, -2); return 1+(*it); } int main(){ //freopen("baskent.gir", "r", stdin); cin >> n >> m; for (int i = 0; i < n-1; i++){ int a, b; cin >> a >> b; a--; b--; adj[a].push_back(b); adj[b].push_back(a); } int ans = f(-1, 0); if (ans < m) cout << "DA" << endl; else cout << "NE" << endl; }
#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...