Submission #689630

# Submission time Handle Problem Language Result Execution time Memory
689630 2023-01-29T03:05:59 Z Warinchai Birmingham (COCI20_birmingham) C++14
15 / 70
97 ms 13784 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 r=path[i]%k;
		if(r!=0){
			cout<<path[i]/k+1<<" ";
		}else{
			cout<<path[i]/k<<" ";
		}
	}
}

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 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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
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 1 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 2660 KB Output is correct
3 Correct 2 ms 2772 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 78 ms 13692 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 67 ms 13748 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 64 ms 13716 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 70 ms 13780 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 74 ms 13704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 97 ms 13784 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 65 ms 13772 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -