# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
631585 |
2022-08-18T09:24:48 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);
adj[y].push_back(x);
}
vector<int> vis(n+1);
priority_queue<array<int, 2>> q;
q.push({1, 1});
int t=0;
vis[1]=1;
while(q.size())
{
priority_queue<array<int, 2>> q2;
vis[q.top()[1]]=1;
if(q.top()[1]!=1)
cout<<q.top()[1];
q.pop();
while(q.size())
{
vis[q.top()[1]]=1;
for(auto i: adj[q.top()[1]])
{
if(!vis[i])
q2.push({(int)(adj[i].size()-1), i});
}
q.pop();
}
q=q2;
t++;
}
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 |
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 |
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 |
328 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 |
328 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 |
- |