Submission #689635

# Submission time Handle Problem Language Result Execution time Memory
689635 2023-01-29T03:22:37 Z Warinchai Birmingham (COCI20_birmingham) C++14
45 / 70
204 ms 10316 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 2 ms 4948 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 3 ms 4948 KB Output is correct
3 Correct 2 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 3 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 3 ms 4948 KB Output is correct
2 Correct 3 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 3 ms 4948 KB Output is correct
3 Correct 3 ms 4880 KB Output is correct
4 Correct 4 ms 4920 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 2 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 155 ms 9832 KB Output is correct
2 Correct 168 ms 10252 KB Output is correct
3 Correct 171 ms 10244 KB Output is correct
4 Correct 120 ms 9548 KB Output is correct
5 Correct 145 ms 9692 KB Output is correct
6 Correct 165 ms 10316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 165 ms 10184 KB Output is correct
2 Correct 189 ms 10072 KB Output is correct
3 Correct 163 ms 10172 KB Output is correct
4 Correct 147 ms 10120 KB Output is correct
5 Incorrect 204 ms 10216 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 157 ms 9960 KB Output is correct
2 Correct 158 ms 10108 KB Output is correct
3 Correct 166 ms 10148 KB Output is correct
4 Correct 152 ms 10128 KB Output is correct
5 Incorrect 152 ms 10040 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 123 ms 9644 KB Output is correct
2 Correct 155 ms 9932 KB Output is correct
3 Correct 156 ms 10196 KB Output is correct
4 Correct 182 ms 9840 KB Output is correct
5 Incorrect 133 ms 9804 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 129 ms 9676 KB Output is correct
2 Correct 173 ms 9892 KB Output is correct
3 Correct 134 ms 9804 KB Output is correct
4 Correct 154 ms 9764 KB Output is correct
5 Correct 146 ms 9808 KB Output is correct
6 Correct 133 ms 9916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 132 ms 9764 KB Output is correct
2 Correct 149 ms 9804 KB Output is correct
3 Correct 171 ms 9776 KB Output is correct
4 Correct 135 ms 10044 KB Output is correct
5 Incorrect 138 ms 9932 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 154 ms 9848 KB Output is correct
2 Correct 133 ms 9604 KB Output is correct
3 Correct 173 ms 10256 KB Output is correct
4 Correct 138 ms 9804 KB Output is correct
5 Incorrect 147 ms 10160 KB Output isn't correct
6 Halted 0 ms 0 KB -