#include <bits/stdc++.h>
using namespace std;
const int N =1e5+37;
#define int long long
vector<int> adj[N];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m, a, b; cin >> n >> m >> a >> b;
vector<int> c(a), vis(n, -1);
for(auto &i: c) cin >> i, i--, vis[i]=0;
queue<int> q;
for(int i=0; i<a; i++){
q.push(c[i]);
}
for(int i=0; i<m; i++){
int x, y; cin >> x >> y;
x--; y--;
adj[x].push_back(y);
adj[y].push_back(x);
}
while(q.size()){
int v = q.front();
q.pop();
for(auto i: adj[v]){
if(vis[i]==-1){
vis[i]=vis[v]+1;
q.push(i);
}
}
}
for(int l=0; l<n; l++){
int k=(vis[l]+b-1)/b;
int s=-1;
for(int j=20; j>=0; j--){
int tmp = s+(1<<j);
if((tmp*(tmp+1))/2>=k) continue;
s=tmp;
}
cout<<s+1<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2660 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
1 ms |
2648 KB |
Output is correct |
4 |
Correct |
1 ms |
2648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
9924 KB |
Output is correct |
2 |
Correct |
58 ms |
10424 KB |
Output is correct |
3 |
Correct |
72 ms |
10948 KB |
Output is correct |
4 |
Correct |
47 ms |
9300 KB |
Output is correct |
5 |
Correct |
51 ms |
9508 KB |
Output is correct |
6 |
Correct |
58 ms |
10836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
60 ms |
10324 KB |
Output is correct |
2 |
Correct |
61 ms |
10088 KB |
Output is correct |
3 |
Correct |
63 ms |
10324 KB |
Output is correct |
4 |
Correct |
59 ms |
10324 KB |
Output is correct |
5 |
Correct |
56 ms |
10124 KB |
Output is correct |
6 |
Correct |
50 ms |
10424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
10032 KB |
Output is correct |
2 |
Correct |
59 ms |
10296 KB |
Output is correct |
3 |
Correct |
60 ms |
10644 KB |
Output is correct |
4 |
Correct |
61 ms |
10584 KB |
Output is correct |
5 |
Correct |
52 ms |
9696 KB |
Output is correct |
6 |
Correct |
55 ms |
10324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
48 ms |
9540 KB |
Output is correct |
2 |
Correct |
53 ms |
10068 KB |
Output is correct |
3 |
Correct |
58 ms |
10584 KB |
Output is correct |
4 |
Correct |
50 ms |
9808 KB |
Output is correct |
5 |
Correct |
54 ms |
9300 KB |
Output is correct |
6 |
Correct |
51 ms |
10112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
59 ms |
9656 KB |
Output is correct |
2 |
Correct |
51 ms |
9808 KB |
Output is correct |
3 |
Correct |
51 ms |
9808 KB |
Output is correct |
4 |
Correct |
50 ms |
9552 KB |
Output is correct |
5 |
Correct |
55 ms |
9848 KB |
Output is correct |
6 |
Correct |
51 ms |
10036 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
9432 KB |
Output is correct |
2 |
Correct |
53 ms |
9960 KB |
Output is correct |
3 |
Correct |
51 ms |
9812 KB |
Output is correct |
4 |
Correct |
53 ms |
10068 KB |
Output is correct |
5 |
Correct |
50 ms |
9760 KB |
Output is correct |
6 |
Correct |
65 ms |
10256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
9552 KB |
Output is correct |
2 |
Correct |
47 ms |
9212 KB |
Output is correct |
3 |
Correct |
59 ms |
10576 KB |
Output is correct |
4 |
Correct |
49 ms |
9556 KB |
Output is correct |
5 |
Correct |
59 ms |
9812 KB |
Output is correct |
6 |
Correct |
59 ms |
10836 KB |
Output is correct |