# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1079399 |
2024-08-28T13:55:27 Z |
fonikos01 |
Burza (COCI16_burza) |
C++14 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
#include <vector>
#include <tuple>
// #include "debugging.h"
// #include <atcoder/lazysegtree>
// #include <atcoder/modint>
// #include <atcoder/dsu>
// #include <atcoder/segtree>
// using namespace atcoder;
// using mint = modint998244353;
using namespace std;
const int LARGE = 1e9;
#define all(x) (x).begin(), (x).end()
using ll = long long;
typedef pair<ll, ll> pi;
// bool cmp(pair<ll, ll> a, pair<ll, ll> b)
// {
// if (a.second < b.second)
// return true;
// return false;
// }
// struct node
// {
// // part which will store data
// int data;
// // pointer to the previous node
// struct node *prev;
// // pointer to the next node
// struct node *next;
// };
const int MOD = 1e9+7;
template<int MOD, int RT> struct mint {
static const int mod = MOD;
static constexpr mint rt() { return RT; } // primitive root
int v;
explicit operator int() const { return v; }
mint():v(0) {}
mint(ll _v):v(int(_v%MOD)) { v += (v<0)*MOD; }
mint& operator+=(mint o) {
if ((v += o.v) >= MOD) v -= MOD;
return *this; }
mint& operator-=(mint o) {
if ((v -= o.v) < 0) v += MOD;
return *this; }
mint& operator*=(mint o) {
v = int((ll)v*o.v%MOD); return *this; }
friend mint pow(mint a, ll p) { assert(p >= 0);
return p==0?1:pow(a*a,p/2)*(p&1?a:1); }
friend mint inv(mint a) { assert(a.v != 0); return pow(a,MOD-2); }
friend mint operator+(mint a, mint b) { return a += b; }
friend mint operator-(mint a, mint b) { return a -= b; }
friend mint operator*(mint a, mint b) { return a *= b; }
};
using mi = mint<(int)MOD, 5>;
ll solve()
{
ll N, K; cin >> N >> K;
vector<vector<ll>> A(N+1, vector<ll>(0));
for (int i = 0; i < N-1; i++) {
ll x, y; cin >> x >> y;A[x].push_back(y);
A[y].push_back(x);
}
auto rec = [&](auto self, ll par, ll node, ll step) {
if (step <= 0) return false;
ll misses = 0;
for (auto nei : A[node]) {
if (nei == par) continue;
if (!self(self, node, nei, step-1)) misses++;
}
if (misses >= 2) return false;
else return true;
};
if (rec(rec, -1, 1, K)) cout << "DA" << '\n';
else cout << "NE" << '\n';
return 0;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("cbarn2.in", "r", stdin);
// freopen("cbarn2.out", "w", stdout);
// ll caseCnt = 1;
// ll T;
// cin >> T;
// while (T--)
// {
solve();
// cout << "Case #"<< caseCnt << ": " << ans << '\n';
// caseCnt++;
// }
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |