답안 #999061

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999061 2024-06-15T05:55:04 Z vjudge1 Birmingham (COCI20_birmingham) C++17
70 / 70
131 ms 7764 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];
        // cout<<node<<' '<<dist[node]<<endl;
        v.pop_front();
        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++){
        int low=-1,high=100001;
        while(high-low>1){
            ll mid=(high+low)/2;
            if(k*(mid*(mid+1))>=dist[i]*2)
                high=mid;
            else
                low=mid;
        }
        cout<<high<<' ';
    }
    cout<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2664 KB Output is correct
3 Correct 1 ms 2664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 7364 KB Output is correct
2 Correct 115 ms 7652 KB Output is correct
3 Correct 126 ms 7636 KB Output is correct
4 Correct 96 ms 7244 KB Output is correct
5 Correct 86 ms 7208 KB Output is correct
6 Correct 118 ms 7764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 7700 KB Output is correct
2 Correct 104 ms 7624 KB Output is correct
3 Correct 113 ms 7656 KB Output is correct
4 Correct 103 ms 7764 KB Output is correct
5 Correct 92 ms 7616 KB Output is correct
6 Correct 120 ms 7244 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 7396 KB Output is correct
2 Correct 102 ms 7668 KB Output is correct
3 Correct 111 ms 7656 KB Output is correct
4 Correct 97 ms 7736 KB Output is correct
5 Correct 95 ms 7272 KB Output is correct
6 Correct 123 ms 7476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 7248 KB Output is correct
2 Correct 91 ms 7420 KB Output is correct
3 Correct 119 ms 7596 KB Output is correct
4 Correct 86 ms 7508 KB Output is correct
5 Correct 83 ms 7252 KB Output is correct
6 Correct 97 ms 7316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 7212 KB Output is correct
2 Correct 95 ms 7300 KB Output is correct
3 Correct 89 ms 7420 KB Output is correct
4 Correct 84 ms 7444 KB Output is correct
5 Correct 84 ms 7516 KB Output is correct
6 Correct 83 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 7304 KB Output is correct
2 Correct 97 ms 7312 KB Output is correct
3 Correct 89 ms 7248 KB Output is correct
4 Correct 85 ms 7508 KB Output is correct
5 Correct 80 ms 7252 KB Output is correct
6 Correct 90 ms 7252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 84 ms 7252 KB Output is correct
2 Correct 75 ms 7088 KB Output is correct
3 Correct 113 ms 7764 KB Output is correct
4 Correct 86 ms 7248 KB Output is correct
5 Correct 85 ms 7576 KB Output is correct
6 Correct 131 ms 7628 KB Output is correct