Submission #845131

# Submission time Handle Problem Language Result Execution time Memory
845131 2023-09-06T12:10:14 Z vjudge1 Birmingham (COCI20_birmingham) C++17
70 / 70
83 ms 11268 KB
#include <bits/stdc++.h>
#define fast cin.tie(0)->sync_with_stdio(0);
#define int long long
#define inf ((int)1e18)
#define N 100005
using namespace std;
bool vis[N];
int way[N];
vector <vector<int> > adj(N);

int32_t main(){
	fast
	int n, m, q, k;
	cin>>n>>m>>q>>k;
	queue <pair<int, int> > que;
	for(int i = 0; i < q; i++) {
		int in;
		cin>>in;
		que.push({in, 0});
		vis[in] = 1;
	}
	for(int i = 0; i < m; i++) {
		int a, b;
		cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	while(!que.empty()) {
		int node = que.front().first, dis = que.front().second;
		way[node] = dis;
		que.pop();
		for(auto it:adj[node]) {
			if(vis[it]) continue;
			vis[it] = 1;
			que.push({it, dis + 1});
		}
	}
	for(int i = 1; i <= n; i++) {
		int val = 0, tk = k;
		while(way[i] > 0) {
			way[i] -= tk;
			tk 	+= k;
			val++; 
		}
		cout<<val<<" ";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 2 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2648 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 10124 KB Output is correct
2 Correct 53 ms 10704 KB Output is correct
3 Correct 62 ms 10940 KB Output is correct
4 Correct 47 ms 9644 KB Output is correct
5 Correct 66 ms 9800 KB Output is correct
6 Correct 81 ms 11268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 10748 KB Output is correct
2 Correct 51 ms 10580 KB Output is correct
3 Correct 56 ms 10800 KB Output is correct
4 Correct 59 ms 10828 KB Output is correct
5 Correct 83 ms 10740 KB Output is correct
6 Correct 49 ms 10324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 10380 KB Output is correct
2 Correct 56 ms 10744 KB Output is correct
3 Correct 73 ms 10932 KB Output is correct
4 Correct 63 ms 10836 KB Output is correct
5 Correct 55 ms 10044 KB Output is correct
6 Correct 45 ms 10432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 9908 KB Output is correct
2 Correct 68 ms 10472 KB Output is correct
3 Correct 76 ms 10736 KB Output is correct
4 Correct 49 ms 10088 KB Output is correct
5 Correct 55 ms 9680 KB Output is correct
6 Correct 55 ms 10336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 9820 KB Output is correct
2 Correct 64 ms 10260 KB Output is correct
3 Correct 49 ms 10076 KB Output is correct
4 Correct 56 ms 10384 KB Output is correct
5 Correct 50 ms 10068 KB Output is correct
6 Correct 47 ms 10100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 9872 KB Output is correct
2 Correct 58 ms 10128 KB Output is correct
3 Correct 60 ms 10004 KB Output is correct
4 Correct 63 ms 10576 KB Output is correct
5 Correct 50 ms 9916 KB Output is correct
6 Correct 48 ms 10468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 10112 KB Output is correct
2 Correct 51 ms 9604 KB Output is correct
3 Correct 60 ms 10880 KB Output is correct
4 Correct 58 ms 9892 KB Output is correct
5 Correct 57 ms 10260 KB Output is correct
6 Correct 71 ms 11088 KB Output is correct