제출 #391535

#제출 시각아이디문제언어결과실행 시간메모리
391535nohaxjustsofloBurza (COCI16_burza)C++17
0 / 160
1 ms332 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int mxN = 405; const int mxP = 7; const int mod = 1e9+7; bool vis[mxN]; int p[mxN]; vector<int> adj[mxN]; int down[mxN]; void dfs(int i) { for(int j : adj[i]) { if(j == p[i]) continue; p[j] = i; down[j] = down[i] + 1; dfs(j); } } ///dali mogu odigrati k koraka bool solve(int i, int k) { if(k == 0) return true; int cnt = 0; for(int j : adj[i]) { if(j == p[i]) continue; cnt += solve(j, k-1); } return cnt > 1; } int main() { int n, k; cin >> n >> k; for(int i = 1; i < n; i++) { int u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } dfs(1); cout << (solve(1, k)?"NE":"DA"); }
#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...