# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
689633 | Warinchai | Birmingham (COCI20_birmingham) | C++14 | 80 ms | 12504 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |