# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
845129 | 2023-09-06T12:09:34 Z | vjudge1 | Birmingham (COCI20_birmingham) | C++14 | 245 ms | 13504 KB |
#include <bits/stdc++.h> using namespace std; void solve(void){ int n,m,q,k; cin >> n >> m >> q >> k; vector<int> insider(q); vector<vector<int>> komsu(n); for(int i=0; i<q; i++) cin >> insider[i]; for(int i=0; i<m; i++){ int a,b; cin >> a >> b; a--; b--; komsu[a].push_back(b); komsu[b].push_back(a); } vector<int> uzaklik(n,-1); priority_queue<pair<int,int>> pq; for(int i=0; i<q; i++){ pq.push({0, insider[i]-1}); } while(pq.size()){ int len = -pq.top().first; int node = pq.top().second; pq.pop(); if( uzaklik[node] != -1 ) continue; uzaklik[node] = len; for(int i=0; i<komsu[node].size(); i++){ pq.push({-len-1, komsu[node][i]}); } } for(int i=0; i<n; i++){ int len = ceil( ((double) uzaklik[i] )/ k ); cout << ceil( (-1 + sqrt(1+8*len))/2 ) << " "; } cout << "\n"; } int main(){ int t=1; // cin >> t; while(t--) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 560 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 600 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 190 ms | 8276 KB | Output is correct |
2 | Correct | 209 ms | 9584 KB | Output is correct |
3 | Correct | 220 ms | 9720 KB | Output is correct |
4 | Correct | 191 ms | 8012 KB | Output is correct |
5 | Correct | 175 ms | 8140 KB | Output is correct |
6 | Correct | 236 ms | 13264 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 199 ms | 9564 KB | Output is correct |
2 | Correct | 245 ms | 9544 KB | Output is correct |
3 | Correct | 198 ms | 9608 KB | Output is correct |
4 | Correct | 199 ms | 9500 KB | Output is correct |
5 | Correct | 177 ms | 9348 KB | Output is correct |
6 | Correct | 190 ms | 9416 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 213 ms | 9412 KB | Output is correct |
2 | Correct | 194 ms | 9420 KB | Output is correct |
3 | Correct | 195 ms | 9784 KB | Output is correct |
4 | Correct | 203 ms | 9444 KB | Output is correct |
5 | Correct | 187 ms | 8320 KB | Output is correct |
6 | Correct | 218 ms | 9448 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 161 ms | 8096 KB | Output is correct |
2 | Correct | 183 ms | 9412 KB | Output is correct |
3 | Correct | 236 ms | 9480 KB | Output is correct |
4 | Correct | 193 ms | 9240 KB | Output is correct |
5 | Correct | 220 ms | 8160 KB | Output is correct |
6 | Correct | 189 ms | 9208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 172 ms | 8088 KB | Output is correct |
2 | Correct | 202 ms | 9156 KB | Output is correct |
3 | Correct | 183 ms | 9160 KB | Output is correct |
4 | Correct | 172 ms | 8136 KB | Output is correct |
5 | Correct | 235 ms | 8332 KB | Output is correct |
6 | Correct | 193 ms | 9160 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 187 ms | 8188 KB | Output is correct |
2 | Correct | 181 ms | 9220 KB | Output is correct |
3 | Correct | 206 ms | 9324 KB | Output is correct |
4 | Correct | 172 ms | 9412 KB | Output is correct |
5 | Correct | 176 ms | 8208 KB | Output is correct |
6 | Correct | 204 ms | 9336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 197 ms | 8236 KB | Output is correct |
2 | Correct | 191 ms | 7888 KB | Output is correct |
3 | Correct | 229 ms | 9664 KB | Output is correct |
4 | Correct | 169 ms | 8144 KB | Output is correct |
5 | Correct | 207 ms | 8484 KB | Output is correct |
6 | Correct | 240 ms | 13504 KB | Output is correct |