# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845389 | vjudge1 | Birmingham (COCI20_birmingham) | C++98 | 500 ms | 11216 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;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long a,b,c,d,e,f,gun,ay,yil,es,p;
vector < vector <long long> > adj;
queue <long long> que;
vector <long long> ana;
long long uza[100005];
memset(uza,-1,sizeof(uza));
cin>>a>>b>>c>>d;
for(long long i=0;a>=i;i++){
adj.push_back(ana);
}
for(long long i=0;c>i;i++){
cin>>f;
ana.push_back(f);
}
for(long long i=0;b>i;i++){
cin>>f>>p;
adj[f].push_back(p);
adj[p].push_back(f);
}
for(long long i=0;c>i;i++){
long long pivot = ana[i];
int vis[100005];
memset(vis,0,sizeof(vis));
uza[pivot] = 0;
que.push(pivot);
while(que.size()){
pivot = que.front();
que.pop();
if(vis[pivot] == 0){
vis[pivot] = 1;
for(long long j=0;adj[pivot].size()>j;j++){
if(uza[adj[pivot][j]] == -1){
uza[adj[pivot][j]] = uza[pivot] + 1;
if(vis[adj[pivot][j]] == 0)
que.push(adj[pivot][j]);
}
else{
if(uza[adj[pivot][j]] > uza[pivot] + 1){
uza[adj[pivot][j]] = uza[pivot] + 1;
if(vis[adj[pivot][j]] == 0)
que.push(adj[pivot][j]);
}
}
}
}
}
}
for(long long i=1;a>=i;i++){
long long pork=1;
//cout<<uza[i]<<" ";
if(uza[i] == 0){
cout<<0<<" ";
}
else{
long long h=(pork * (pork+1));
h/=2;
h*=d;
while(h < uza[i]){
pork++;
h=(pork * (pork+1));
h/=2;
h*=d;
}
cout<<pork<<" ";
}
}
}
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... |