# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
575371 | ddy888 | Job Scheduling (CEOI12_jobs) | C++17 | 49 ms | 49824 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#undef _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define fi first
#define si second
typedef pair<int,int> pi;
typedef tuple<int,int,int> ti;
void debug_out() {cerr<<endl;}
template <typename Head, typename... Tail>
void debug_out(Head _H, Tail... _T) {cerr<<" "<<to_string(_H);debug_out(_T...);}
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 100010;
int n, d, m;
pi arr[MAXN];
vector<int> ans[MAXN * 10];
bool good(int num, int flag) {
int j = 1;
for (int i = 1; i <= n; ++i) {
int cnt = num;
while (j <= m && cnt && arr[j].fi <= i) {
if (i - arr[j].fi > d) return false;
if (flag) ans[i].pb(arr[j].si);
++j;
--cnt;
}
}
return j >= m;
}
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> d >> m;
for (int i = 1; i <= m; ++i) cin >> arr[i].fi, arr[i].si = i;
sort(arr + 1, arr + 1 + m);
assert(n >= m);
int lo = 0, hi = m + 1;
while (lo + 1 < hi) {
int mid = (lo + hi) >> 1;
if (good(mid, 0)) hi = mid;
else lo = mid;
}
cout << hi << '\n';
// good(hi, 1);
// for (int i = 1; i <= n; ++i) {
// for (auto j: ans[i]) cout << j << ' ';
// cout << 0 << '\n';
// }
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |