# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
253246 | 2020-07-27T14:20:59 Z | blacktulip | Birmingham (COCI20_birmingham) | C++17 | 193 ms | 24232 KB |
#include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define mp make_pair #define endl "\n" #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const lo inf = 1000000000000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 500005; const lo mod = 1000000007; int n,m,b[li],a[li],k,flag,t,vis[li]; int cev; string s; queue<PII> pq; vector<int> v[li]; inline void sp(){ while(pq.size()){ int co=pq.front().fi; int node=pq.front().se; pq.pop(); //~ cout<<node<<" : : "<<co<<endl; if(vis[node])continue; vis[node]=1; int at=0; for(int i=1;i<=100000;i++){ if(at>=co){a[node]=i-1;break;} at+=k*i; if(at>=co){a[node]=i;break;} } for(int i=0;i<(int)v[node].size();i++){ int go=v[node][i]; pq.push({co+1,go}); } } } int main(void){ scanf("%d %d %d %d",&n,&m,&t,&k); while(t--){ int x; scanf("%d",&x); pq.push({0,x}); } for(int i=1;i<=m;i++){ int x,y; scanf("%d %d",&x,&y); v[x].pb(y); v[y].pb(x); } sp(); FOR printf("%d ",a[i]); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12032 KB | Output is correct |
2 | Correct | 7 ms | 12032 KB | Output is correct |
3 | Correct | 7 ms | 12032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12032 KB | Output is correct |
2 | Correct | 8 ms | 12032 KB | Output is correct |
3 | Correct | 8 ms | 12032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 12032 KB | Output is correct |
2 | Correct | 7 ms | 12032 KB | Output is correct |
3 | Correct | 7 ms | 12032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12032 KB | Output is correct |
2 | Correct | 8 ms | 12032 KB | Output is correct |
3 | Correct | 8 ms | 12032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 12032 KB | Output is correct |
2 | Correct | 7 ms | 12032 KB | Output is correct |
3 | Correct | 7 ms | 12032 KB | Output is correct |
4 | Correct | 8 ms | 12032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12032 KB | Output is correct |
2 | Correct | 8 ms | 12032 KB | Output is correct |
3 | Correct | 7 ms | 12032 KB | Output is correct |
4 | Correct | 8 ms | 12032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12032 KB | Output is correct |
2 | Correct | 7 ms | 12032 KB | Output is correct |
3 | Correct | 7 ms | 12032 KB | Output is correct |
4 | Correct | 7 ms | 12032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 118 ms | 21112 KB | Output is correct |
2 | Correct | 126 ms | 22008 KB | Output is correct |
3 | Correct | 143 ms | 23416 KB | Output is correct |
4 | Correct | 111 ms | 20216 KB | Output is correct |
5 | Correct | 111 ms | 20472 KB | Output is correct |
6 | Correct | 147 ms | 24232 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 193 ms | 21880 KB | Output is correct |
2 | Correct | 162 ms | 21632 KB | Output is correct |
3 | Correct | 136 ms | 22776 KB | Output is correct |
4 | Correct | 163 ms | 22140 KB | Output is correct |
5 | Correct | 125 ms | 21624 KB | Output is correct |
6 | Correct | 120 ms | 22904 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 124 ms | 21224 KB | Output is correct |
2 | Correct | 160 ms | 22136 KB | Output is correct |
3 | Correct | 173 ms | 23288 KB | Output is correct |
4 | Correct | 137 ms | 22136 KB | Output is correct |
5 | Correct | 112 ms | 20856 KB | Output is correct |
6 | Correct | 162 ms | 22904 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 103 ms | 20472 KB | Output is correct |
2 | Correct | 153 ms | 21652 KB | Output is correct |
3 | Correct | 133 ms | 22904 KB | Output is correct |
4 | Correct | 114 ms | 20984 KB | Output is correct |
5 | Correct | 113 ms | 20344 KB | Output is correct |
6 | Correct | 120 ms | 22776 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 120 ms | 20504 KB | Output is correct |
2 | Correct | 139 ms | 21112 KB | Output is correct |
3 | Correct | 113 ms | 21752 KB | Output is correct |
4 | Correct | 109 ms | 20856 KB | Output is correct |
5 | Correct | 116 ms | 21112 KB | Output is correct |
6 | Correct | 114 ms | 22392 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 105 ms | 20600 KB | Output is correct |
2 | Correct | 116 ms | 21112 KB | Output is correct |
3 | Correct | 110 ms | 21880 KB | Output is correct |
4 | Correct | 122 ms | 21496 KB | Output is correct |
5 | Correct | 110 ms | 20984 KB | Output is correct |
6 | Correct | 137 ms | 22904 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 128 ms | 20856 KB | Output is correct |
2 | Correct | 116 ms | 20328 KB | Output is correct |
3 | Correct | 146 ms | 23160 KB | Output is correct |
4 | Correct | 110 ms | 20740 KB | Output is correct |
5 | Correct | 119 ms | 21240 KB | Output is correct |
6 | Correct | 148 ms | 24048 KB | Output is correct |