Submission #238448

#TimeUsernameProblemLanguageResultExecution timeMemory
238448vankataBirmingham (COCI20_birmingham)C++14
20 / 70
300 ms11888 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = (int )(1<<17); vector<long long >v[MAXN]; vector <long long > rig; long long n,m,q,k,used[MAXN]; void BFS() { long long i,j; queue<long long >q; for(auto nb:rig) { used[nb]=true; q.push(nb); } while(!q.empty()) { i=q.front(); q.pop(); for(auto nb:v[i]) { if(!used[nb]) { used[nb]=used[i]+1; q.push(nb); } } } } void read() { long long i,j,x,y; cin>>n>>m>>q>>k; for(i=0;i<q;i++) { cin>>x; rig.push_back(x); } for(i=0;i<m;i++) { cin>>x>>y; v[x].push_back(y); v[y].push_back(x); } } void solve() { long long i,ans=0; for(i=1;i<=n;i++) { used[i]--; ans = ceil((-1+sqrt(1+4*used[i]*2/k))/2); cout<<ans<<" "; }cout<<endl; } int main() { read(); BFS(); solve(); return 0; }

Compilation message (stderr)

birmingham.cpp: In function 'void BFS()':
birmingham.cpp:9:18: warning: unused variable 'j' [-Wunused-variable]
     long long  i,j;
                  ^
birmingham.cpp: In function 'void read()':
birmingham.cpp:32:18: warning: unused variable 'j' [-Wunused-variable]
     long long  i,j,x,y;
                  ^
#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...