Submission #845114

#TimeUsernameProblemLanguageResultExecution timeMemory
845114vjudge1Birmingham (COCI20_birmingham)C++17
70 / 70
110 ms10956 KiB
#include <bits/stdc++.h> #pragma optimize "DostSeferoğlu" #pragma GCC optimize("unroll-loops,Ofast") #pragma GCC target("avx2,tune=native") using namespace std; #define int long long #define pii pair<int,int> #define bg begin #define vi vector<int> #define endl '\n' #define vvi vector<vi> #define pc __builtin_popcountll #define vp vector<pii> #define sp << " " << #define all(x) x.bg()+1,x.end() #define ff first #define ss second #define brake {cout << "OK\n";return;} #define debug(x) {cout << #x << ": "; for (auto it : x) cout << it << " ";cout << endl;} #define FF(xxx,sss,yyy) for (int xxx=sss;xxx<=yyy;++xxx) #define F(xx,yy) for (int xx=1;xx<=yy;++xx) #define pb push_back const int inf = 1e18; const int MOD = 998244353; const int N = 2e5+1; void solve() { int n,m,Q,k; cin >> n >> m >> Q >> k; vi edges[n+1]; vi people; F(i,Q) { int p; cin >> p; people.pb(p); } F(i,m) { int a,b; cin >> a >> b; edges[a].pb(b); edges[b].pb(a); } queue<int> q; vi dists(n+1,inf); F(i,Q) dists[people[i-1]] = 0; for (auto it : people) { q.push(it); } while (!q.empty()) { int f = q.front(); q.pop(); for (auto nb : edges[f]) { if (dists[nb] == inf) { dists[nb] = dists[f]+1; q.push(nb); } } } F(i,n) { int l = 0; int r = 100000; while (l<=r) { int mid = (l+r) >> 1; if (mid*(mid+1)/2*k >= dists[i]) r = mid-1; else l = mid+1; } dists[i] = l; } F(i,n) cout << dists[i] << " "; cout << endl; } signed main() { ios_base::sync_with_stdio(0);cin.tie(0); #ifdef Local freopen("input.in", "r", stdin); freopen("input.out", "w", stdout); #endif int t = 1; //cin >> t; while (t --> 0) solve(); }

Compilation message (stderr)

birmingham.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize "DostSeferoğlu"
      |
#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...