Submission #689635

#TimeUsernameProblemLanguageResultExecution timeMemory
689635WarinchaiBirmingham (COCI20_birmingham)C++14
45 / 70
204 ms10316 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...