Submission #689633

# Submission time Handle Problem Language Result Execution time Memory
689633 2023-01-29T03:19:00 Z Warinchai Birmingham (COCI20_birmingham) C++14
35 / 70
80 ms 12504 KB
#include<bits/stdc++.h>
using namespace std;
queue<pair<int,int> >q;
vector<int>v[100000];
int path[100005];
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 2644 KB Output is correct
2 Correct 2 ms 2696 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2656 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 1 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 71 ms 12492 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 72 ms 12468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 71 ms 12440 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 80 ms 12504 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 73 ms 12420 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 65 ms 12488 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 70 ms 12416 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -