Submission #689636

# Submission time Handle Problem Language Result Execution time Memory
689636 2023-01-29T03:22:51 Z Warinchai Birmingham (COCI20_birmingham) C++14
45 / 70
178 ms 10320 KB
#include<bits/stdc++.h>
using namespace std;
queue<pair<int,int> >q;
vector<int>v[200005];
int path[200005];
int main(){
	int n,m,nn,k;
	cin>>n>>m>>nn>>k;
	for(int i=1;i<=n;i++){
		path[i]=INT_MAX;
	}
	for(int i=0;i<nn;i++){
		int a;
		cin>>a;
		q.push({a,0});
		path[a]=0;
	}
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	//cout<<"info\n";
	while(!q.empty()){
		int a=q.front().first;
		int b=q.front().second;
		//cout<<a<<" "<<b<<endl;
		q.pop();
		for(int i=0;i<v[a].size();i++){
			if(b+1<path[v[a][i]]){
				path[v[a][i]]=b+1;
				q.push({v[a][i],b+1});
			}
		}
	}
	for(int i=1;i<=n;i++){
		int st=0,en=700,ans=0;
		while(en>=st){
			int md=(st+en)/2;
			if(md*(md+1)/2*k>=path[i]){
				ans=md;
				en=md-1;
			}else{
				st=md+1;
			}
		}
		cout<<ans<<" ";
	}
}

Compilation message

birmingham.cpp: In function 'int main()':
birmingham.cpp:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int i=0;i<v[a].size();i++){
      |               ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 4 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 4 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 3 ms 4896 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 2 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 4 ms 4948 KB Output is correct
3 Correct 4 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 2 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 156 ms 9836 KB Output is correct
2 Correct 176 ms 10108 KB Output is correct
3 Correct 160 ms 10236 KB Output is correct
4 Correct 122 ms 9616 KB Output is correct
5 Correct 139 ms 9792 KB Output is correct
6 Correct 177 ms 10256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 166 ms 10188 KB Output is correct
2 Correct 141 ms 9932 KB Output is correct
3 Correct 154 ms 10060 KB Output is correct
4 Correct 178 ms 10320 KB Output is correct
5 Incorrect 140 ms 10156 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 137 ms 9860 KB Output is correct
2 Correct 160 ms 10148 KB Output is correct
3 Correct 176 ms 10316 KB Output is correct
4 Correct 155 ms 10156 KB Output is correct
5 Incorrect 150 ms 10048 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 147 ms 9696 KB Output is correct
2 Correct 173 ms 10020 KB Output is correct
3 Correct 157 ms 10164 KB Output is correct
4 Correct 129 ms 9832 KB Output is correct
5 Incorrect 153 ms 9804 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 132 ms 9640 KB Output is correct
2 Correct 137 ms 9984 KB Output is correct
3 Correct 137 ms 9748 KB Output is correct
4 Correct 153 ms 9912 KB Output is correct
5 Correct 131 ms 9900 KB Output is correct
6 Correct 147 ms 9852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 128 ms 9716 KB Output is correct
2 Correct 148 ms 9932 KB Output is correct
3 Correct 133 ms 9748 KB Output is correct
4 Correct 155 ms 9996 KB Output is correct
5 Incorrect 133 ms 9936 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 158 ms 9844 KB Output is correct
2 Correct 119 ms 9636 KB Output is correct
3 Correct 156 ms 10144 KB Output is correct
4 Correct 145 ms 9760 KB Output is correct
5 Incorrect 145 ms 10156 KB Output isn't correct
6 Halted 0 ms 0 KB -