# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
631599 |
2022-08-18T09:39:06 Z |
berr |
Burza (COCI16_burza) |
C++17 |
|
1 ms |
340 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int> adj[500];
int32_t main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
int n, k; cin>>n>>k;
for(int i=0; i<n-1; i++)
{
int x, y; cin>>x>>y;
adj[x].push_back(y);
}
vector<int> vis(n+1);
priority_queue<array<int, 2>> q;
q.push({1, 1});
int t=0;
vis[1]=1;
if(adj[1].size()>0)
while(q.size())
{
priority_queue<array<int, 2>> q2;
vis[q.top()[1]]=1;
if(q.top()[1]!=1)
q.pop();
if(q.size()) t++;
while(q.size())
{
vis[q.top()[1]]=1;
for(auto i: adj[q.top()[1]])
{
if(!vis[i])
q2.push({(int)(adj[i].size()), i}), vis[i]=1;
}
q.pop();
}
q=q2;
}
if(t<=k) cout<<"DA";
else cout<<"NE";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
268 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |