# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
710039 | ToroTN | Birmingham (COCI20_birmingham) | C++14 | 121 ms | 9960 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;
#define pb push_back
int n,m,num,a,u_i,v_i,k,d[100005],u,hsh[100005],sum=0;
vector<int> v[100005];
queue<int> q;
int main()
{
memset(d,-1,sizeof d);
scanf("%d%d%d%d",&n,&m,&num,&k);
for(int i=1;i<=100000;i++)
{
for(int j=1;j<=k*i;j++)
{
++sum;
//printf("%d %d\n",i,j);
//printf("%d\n",sum);
hsh[sum]=i;
if(sum==100000)break;
}
if(sum==100000)break;
}
for(int i=1;i<=num;i++)
{
scanf("%d",&a);
d[a]=0;
q.push(a);
}
for(int i=1;i<=m;i++)
{
scanf("%d%d",&u_i,&v_i);
v[u_i].pb(v_i);
v[v_i].pb(u_i);
}
while(!q.empty())
{
u=q.front();
//printf("%d %d\n",u,d[u]);
q.pop();
for(auto node:v[u])
{
if(d[node]==-1)
{
d[node]=d[u]+1;
q.push(node);
}
}
}
//printf("%d\n",d[4]);
for(int i=1;i<=n;i++)
{
printf("%d ",hsh[d[i]]);
}
printf("\n");
}
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... |