# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
845203 | 2023-09-06T12:34:32 Z | vjudge1 | Birmingham (COCI20_birmingham) | C++17 | 110 ms | 8912 KB |
#include <iostream> #include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long #define pri pair<int,int> #define prl pair<ll,ll> #define vi vector<int> #define vl vector<ll> #define vp vector<pair<int,int>> #define vpl vector<pair<ll,ll>> #define re return 0 #define sqrt sqrtl struct node { int val; vector<int> adj; int length=1e9; }; int32_t main() { int n,m,k,q;cin>>n>>m>>q>>k; queue<int> que; vector<node> nodes(n+1); for (int i = 0;i<q;i++) { int x;cin>>x; que.push(x); nodes[x].length = 0; } for (int i = 0;i<m;i++ ){ int a,b;cin>>a>>b; nodes[a].adj.push_back(b); nodes[b].adj.push_back(a); } while (que.size()) { auto f = que.front(); for (int i = 0; i<nodes[f].adj.size();i++) { if(nodes[nodes[f].adj[i]].length > nodes[f].length+1) { nodes[nodes[f].adj[i]].length = nodes[f].length+1; que.push(nodes[f].adj[i]); } } que.pop(); } for (int i = 1;i<=n;i++){ int x = nodes[i].length; if (x==0) { cout<<0<<" ";continue; } int start = k; int to = start; int amt = 1; while (x>to) { start*=2; to+=start; amt++; } cout<<amt<<" "; }cout<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 99 ms | 8528 KB | Output is correct |
2 | Incorrect | 108 ms | 8912 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 109 ms | 8792 KB | Output is correct |
2 | Incorrect | 98 ms | 8816 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 104 ms | 8784 KB | Output is correct |
2 | Incorrect | 110 ms | 8784 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 88 ms | 8528 KB | Output is correct |
2 | Incorrect | 103 ms | 8632 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 90 ms | 8312 KB | Output is correct |
2 | Incorrect | 96 ms | 8688 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 89 ms | 8416 KB | Output is correct |
2 | Incorrect | 105 ms | 8528 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 92 ms | 8528 KB | Output is correct |
2 | Incorrect | 102 ms | 8784 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |