제출 #1301909

#제출 시각아이디문제언어결과실행 시간메모리
1301909BzslayedJob Scheduling (CEOI12_jobs)C++20
100 / 100
186 ms16152 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define ll long long #define ull unsigned long long #define ld long double #define pll pair<ll, ll> #define pii pair<int, int> #define coutpair(p) cout << p.first << " " << p.second << "|" template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; const ll INF = 1e15; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n, d, m; cin >> n >> d >> m; pll jb[m]; for (int i=0; i<m; i++) cin >> jb[i].first, jb[i].second = i+1; sort(jb, jb+m); ll lo = 1, hi = 1e9, ans = INF; while (lo <= hi){ ll x = (lo+hi)/2; deque<pll> dq; for (int i=1; i<=n; i++) dq.push_back({i, x}); bool pos = true; for (int i=0; i<m; i++){ ll tar = jb[i].first+d; if (tar < dq.front().first || dq.empty()){ pos = false; break; } while (jb[i].first > dq.front().first) dq.pop_front(); dq.front().second--; if (dq.front().second == 0) dq.pop_front(); } if (pos) hi = x-1, ans = min(ans, x); else lo = x+1; } cout << ans << "\n"; for (int i=0; i<n; i++) cout << 0 << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...