답안 #733129

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
733129 2023-04-30T06:52:26 Z vjudge1 Birmingham (COCI20_birmingham) C++17
70 / 70
139 ms 16536 KB
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

vector<int>v[100005];
int ans[100005],vis[100005];

int32_t main(){
	fast;
	int n,m,x,k;
	cin>>n>>m>>x>>k;
	vector<int>v2;
	for(int i=0;i<=100000;i++)v2.pb(i*(i+1)/2*k);
	queue<pair<int,int>>q;
	while(x--){
		int y;
		cin>>y;
		q.push({y,0});
	}
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	while(!q.empty()){
		int node=q.front().ff;
		int d=q.front().ss;
		q.pop();
		if(vis[node])continue;
		vis[node]=1;
		int ind=lower_bound(all(v2),d)-v2.begin();
		ans[node]=ind;
		for(auto i:v[node]){
			if(vis[i])continue;
			q.push({i,d+1});
		}
	}
	for(int i=1;i<=n;i++)cout<<ans[i]<<" ";
	cout<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3796 KB Output is correct
2 Correct 3 ms 3796 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3796 KB Output is correct
2 Correct 3 ms 3832 KB Output is correct
3 Correct 3 ms 3824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3796 KB Output is correct
2 Correct 3 ms 3796 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3796 KB Output is correct
2 Correct 3 ms 3828 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3824 KB Output is correct
2 Correct 4 ms 3796 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
4 Correct 4 ms 3832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3796 KB Output is correct
2 Correct 3 ms 3824 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
4 Correct 3 ms 3796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3796 KB Output is correct
2 Correct 3 ms 3796 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
4 Correct 3 ms 3796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 115 ms 14088 KB Output is correct
2 Correct 116 ms 15056 KB Output is correct
3 Correct 115 ms 16256 KB Output is correct
4 Correct 98 ms 13056 KB Output is correct
5 Correct 102 ms 13516 KB Output is correct
6 Correct 127 ms 16536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 96 ms 15172 KB Output is correct
2 Correct 101 ms 14628 KB Output is correct
3 Correct 115 ms 15432 KB Output is correct
4 Correct 116 ms 15228 KB Output is correct
5 Correct 115 ms 14744 KB Output is correct
6 Correct 87 ms 15060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 14372 KB Output is correct
2 Correct 110 ms 15176 KB Output is correct
3 Correct 116 ms 16024 KB Output is correct
4 Correct 139 ms 15256 KB Output is correct
5 Correct 96 ms 13864 KB Output is correct
6 Correct 80 ms 15248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 13396 KB Output is correct
2 Correct 84 ms 14604 KB Output is correct
3 Correct 86 ms 15600 KB Output is correct
4 Correct 90 ms 14092 KB Output is correct
5 Correct 132 ms 13396 KB Output is correct
6 Correct 94 ms 15024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 13500 KB Output is correct
2 Correct 109 ms 14096 KB Output is correct
3 Correct 97 ms 14412 KB Output is correct
4 Correct 98 ms 13880 KB Output is correct
5 Correct 102 ms 14088 KB Output is correct
6 Correct 86 ms 14880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 92 ms 13592 KB Output is correct
2 Correct 83 ms 14260 KB Output is correct
3 Correct 75 ms 14624 KB Output is correct
4 Correct 136 ms 14592 KB Output is correct
5 Correct 79 ms 13792 KB Output is correct
6 Correct 98 ms 15256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 13896 KB Output is correct
2 Correct 75 ms 13252 KB Output is correct
3 Correct 89 ms 15920 KB Output is correct
4 Correct 94 ms 13840 KB Output is correct
5 Correct 87 ms 14292 KB Output is correct
6 Correct 90 ms 16492 KB Output is correct