답안 #885175

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
885175 2023-12-09T07:32:08 Z PieArmy Burza (COCI16_burza) C++17
0 / 160
1 ms 600 KB
#include <bits/stdc++.h>
typedef long long ll;
#define yem(re) (1ll<<(ll(re)))
#define endl '\n'
#define pb push_back
#define int long long
#define mid ((left+right)/2)
#define L(emanuelLasker,joseRaulCapablanca,anatolyKarpov) for(int emanuelLasker=(joseRaulCapablanca);emanuelLasker<=(anatolyKarpov);emanuelLasker++)
#define R(magnusCarlsen,paulMorphy,bobbyFischer) for(int magnusCarlsen=(paulMorphy);magnusCarlsen>=(bobbyFischer);magnusCarlsen--)
#define cint(vladimirKramnik) int vladimirKramnik;cin>>vladimirKramnik
#define inf (2e18+5)
#define sc second
#define fr first
#define Bismillahirrahmanirrahim ios_base::sync_with_stdio(false);cin.tie(NULL);
#define cinarr(mikhailTal) for(auto &garryKasparov:mikhailTal)cin>>garryKasparov;
#define all(mustafaKemalAtaturk) mustafaKemalAtaturk.begin(),mustafaKemalAtaturk.end()

using namespace std;
mt19937 rng(chrono::high_resolution_clock().now().time_since_epoch().count());

int32_t main(){
	Bismillahirrahmanirrahim
	int n,k;cin>>n>>k;
	vector<vector<int>>komsu(n,vector<int>(0));
	L(i,1,n-1){
		cint(x);cint(y);
		x--;y--;
		komsu[x].pb(y);
		komsu[y].pb(x);
	}
	function<int(int,int,int)>f=[&](int pos,int root,int dep)->int{
		if(dep==k)return 1;
		multiset<int>st;
		for(int x:komsu[pos]){
			if(x==root)continue;
			st.insert(-f(x,pos,dep+1));
		}
		if(st.size()==0)return 0;
		int x=(*st.begin())+1;
		st.erase(st.begin());
		st.insert(x);
		return max(0ll,-(*st.begin()));
	};
	int ans=f(0,0,0);
	if(ans)cout<<"NE";
	else cout<<"DA";
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -