#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define endl '\n'
using namespace std;
const int N = 1e5 + 5;
int n,m,p,k,dist[N];
vector<int> g[N];
queue<int> q;
bool vis[N];
void bfs(){
while(!q.empty()){
int x=q.front(); q.pop();
vis[x]=true;
for(auto go: g[x]){
if(vis[go]) continue;
dist[go]=dist[x]+1;
vis[go]=true;
q.push(go);
//cout<<go<<" from "<<x<<" with "<<dist[go]<<endl;
}
}
}
void solve(){
cin>>n>>m>>p>>k;
for(int i=0;i<p;i++){
int x; cin>>x;
q.push(x);
}
for(int i=0;i<m;i++){
int a,b; cin>>a>>b;
g[a].pb(b);
g[b].pb(a);
}
vector<int> vec;
bfs();
for(int i=0;i<=2e5+3;i++)
vec.pb(i*(i+1)*k/2);
for(int i=1;i<=n;i++){
auto it=lower_bound(vec.begin(),vec.end(),dist[i]);
cout<<it-vec.begin()<<" ";
}
}
int32_t main(){
cin.tie(0)->sync_with_stdio(false);
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4820 KB |
Output is correct |
2 |
Correct |
2 ms |
4820 KB |
Output is correct |
3 |
Incorrect |
2 ms |
4824 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4816 KB |
Output is correct |
2 |
Correct |
3 ms |
4824 KB |
Output is correct |
3 |
Incorrect |
2 ms |
4824 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4824 KB |
Output is correct |
2 |
Incorrect |
2 ms |
4820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4820 KB |
Output is correct |
2 |
Correct |
2 ms |
4820 KB |
Output is correct |
3 |
Incorrect |
2 ms |
4824 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4820 KB |
Output is correct |
2 |
Correct |
2 ms |
4820 KB |
Output is correct |
3 |
Correct |
2 ms |
4820 KB |
Output is correct |
4 |
Incorrect |
2 ms |
4824 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4820 KB |
Output is correct |
2 |
Incorrect |
2 ms |
4820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4824 KB |
Output is correct |
2 |
Incorrect |
2 ms |
4824 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
11648 KB |
Output is correct |
2 |
Correct |
54 ms |
12364 KB |
Output is correct |
3 |
Incorrect |
66 ms |
12608 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
59 ms |
12228 KB |
Output is correct |
2 |
Correct |
61 ms |
11928 KB |
Output is correct |
3 |
Incorrect |
56 ms |
12360 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
11900 KB |
Output is correct |
2 |
Correct |
56 ms |
12392 KB |
Output is correct |
3 |
Incorrect |
61 ms |
12620 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
11472 KB |
Output is correct |
2 |
Correct |
53 ms |
11976 KB |
Output is correct |
3 |
Incorrect |
55 ms |
12364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
11580 KB |
Output is correct |
2 |
Correct |
74 ms |
11716 KB |
Output is correct |
3 |
Incorrect |
51 ms |
11852 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
11428 KB |
Output is correct |
2 |
Correct |
57 ms |
11804 KB |
Output is correct |
3 |
Incorrect |
50 ms |
11736 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
11720 KB |
Output is correct |
2 |
Correct |
46 ms |
11204 KB |
Output is correct |
3 |
Incorrect |
59 ms |
12360 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |