Submission #845162

#TimeUsernameProblemLanguageResultExecution timeMemory
845162vjudge1Birmingham (COCI20_birmingham)C++14
70 / 70
71 ms9556 KiB
// Aber der schlimmste Fiend, dem du begegnen kannst, wirst du immer dir selber sein #include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native") #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL); #define ff first #define ss second #define pb push_back #define rev reverse #define all(x) x.begin(),x.end() #define acc accumulate #define sz size() #define MOD 1000000007 #define rall(x) x.rbegin(),x.rend() #define rep(i, x, n) for(int i = x; i < n; i++) using namespace std; const int N = 1e5 + 5; vector<int> adj[N]; int vis[N], ans[N]; inline void solve(){ int n, m, q, k; cin >> n >> m >> q >> k; int a[q]; for(int i = 0; i < q; i++){ cin >> a[i]; } for(int i = 0, x, y; i < m; i++){ cin >> x >> y; adj[x].pb(y); adj[y].pb(x); } queue<pair<int, int> > Q; for(int i = 0; i < q; i++){ Q.push({a[i], 0}); vis[a[i]] = 1; } while(!Q.empty()){ int node = Q.front().ff, step = Q.front().ss; Q.pop(); ans[node] = step; for(int i = 0; i < adj[node].sz; i++){ if(!vis[adj[node][i]]){ vis[adj[node][i]] = 1; Q.push({adj[node][i], step+1}); } } } for(int i = 1; i <= n; i++){ int cnt = 0, carp = 1, sum = 0; while(sum < ans[i]){ cnt++; sum += carp * k; carp++; } cout << cnt << " "; } } int main(){ fast_io int t; t = 1; while(t--) solve(); }

Compilation message (stderr)

birmingham.cpp: In function 'void solve()':
birmingham.cpp:42:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |         for(int i = 0; i < adj[node].sz; i++){
      |                          ^
#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...