Submission #998998

#TimeUsernameProblemLanguageResultExecution timeMemory
998998vjudge1Birmingham (COCI20_birmingham)C++17
70 / 70
180 ms12884 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, m, p, k, dist[N]; queue<int> q; vector<int> g[N]; int main(){ memset(dist, 31, sizeof dist); cin >> n >> m >> p >> k; for (int i = 0; i < p; i ++){ int v; cin >> v; q.push(v); dist[v] = 0; } for (int i = 0; i < m; i ++){ int u, v; cin >> u >> v; g[u].push_back(v); g[v].push_back(u); } while (!q.empty()){ int v = q.front(); q.pop(); for (int u : g[v]){ if (dist[u] > dist[v] + 1){ q.push(u); dist[u] = dist[v] + 1; } } } for (int i = 1; i <= n; i ++){ int sm = 0; for (int x = 0; x <= n; x ++){ sm += (x * k); if (dist[i] <= sm){ cout << x << " "; break; } } } cout << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...