답안 #885181

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
885181 2023-12-09T07:39:48 Z PieArmy Burza (COCI16_burza) C++17
0 / 160
1 ms 500 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;
		int sum=0;
		for(int x:komsu[pos]){
			if(x==root)continue;
			sum+=f(x,pos,dep+1);
		}
		return max(0ll,sum-1);
	};
	int ans=f(0,0,0);
	if(ans)cout<<"NE";
	else cout<<"DA";
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 500 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 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 464 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 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 356 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 388 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 -