제출 #967314

#제출 시각아이디문제언어결과실행 시간메모리
967314blackslexBurza (COCI16_burza)C++17
0 / 160
1 ms432 KiB
#include<bits/stdc++.h> using namespace std; int n, k, x, y; int main() { scanf("%d %d", &n, &k); vector<vector<int>> v(n + 5, vector<int>()); for (int i = 1; i < n; i++) scanf("%d %d", &x, &y), v[x].emplace_back(y), v[y].emplace_back(x); vector<int> dp(n + 5); function<void(int, int)> dfs = [&] (int cur, int par) { bool isleaf = 1; vector<int> u; for (auto &e: v[cur]) { if (par == e) continue; isleaf = 0; dfs(e, cur); u.emplace_back(dp[e]); } sort(u.rbegin(), u.rend()); if (u.size() >= 2) dp[cur] = u[1] + 1; }; dfs(1, 0); printf("%s", dp[1] >= k ? "NE" : "DA"); }

컴파일 시 표준 에러 (stderr) 메시지

burza.cpp: In lambda function:
burza.cpp:16:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   16 |             if (par == e) continue; isleaf = 0;
      |             ^~
burza.cpp:16:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   16 |             if (par == e) continue; isleaf = 0;
      |                                     ^~~~~~
burza.cpp:13:14: warning: variable 'isleaf' set but not used [-Wunused-but-set-variable]
   13 |         bool isleaf = 1;
      |              ^~~~~~
burza.cpp: In function 'int main()':
burza.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
burza.cpp:10:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     for (int i = 1; i < n; i++) scanf("%d %d", &x, &y), v[x].emplace_back(y), v[y].emplace_back(x);
      |                                 ~~~~~^~~~~~~~~~~~~~~~~
#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...