Submission #999030

# Submission time Handle Problem Language Result Execution time Memory
999030 2024-06-15T05:28:19 Z vjudge1 Birmingham (COCI20_birmingham) C++17
0 / 70
1000 ms 7252 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
int const N=1e5+5;
int const inf=1e9+7;

int dist[N];
deque<int> v;
vector<int> adj[N];

int main(){
    int n,m,q,k;
    cin>>n>>m>>q>>k;
    for(int i=0;i<=n;i++)
        dist[i]=inf;
    for(int i=1;i<=q;i++){
        int a;
        cin>>a;
        v.push_back(a);
        dist[a]=0;
    }
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    while(v.size()){
        int node=v[0];
        for(int u:adj[node])
            if(dist[u]>dist[node]+1){
                dist[u]=dist[node]+1;
                v.push_back(u);
            }
    }
    for(int i=1;i<=n;i++)
        cout<<max((dist[i]-1)/k,0)<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 2652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1012 ms 2648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1016 ms 2648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 2652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 2652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 2648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 2652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 6992 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 7252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 7068 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 6996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 6996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 6996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1004 ms 6992 KB Time limit exceeded
2 Halted 0 ms 0 KB -