# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745496 | Nafeeszx | Job Scheduling (CEOI12_jobs) | C++14 | 90 ms | 10728 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define trav(a, x) for(auto& a : x)
#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define ROF(i, a, b) for (int i=(a); i>=(signed)(b); i--)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define vi vector<int>
#define f first
#define s second
#define all(v) (v).begin(), (v).end()
typedef long long ll;
const int mod = 1e9 + 7, MOD = 998244353;
const int N = 2005;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n, m, d;
cin >> n >> d >> m;
vector<int> v(m);
vector<vector<int>> tind(n-d+1);
F0R(i, m) {
cin >> v[i];
tind[v[i]].push_back(i);
}
int hi = m, lo = 0;
while(hi - lo > 1) {
int mid = (hi+lo)/2;
bool ok = true;
int c = 0;
FOR(i, 1, n-d) {
if(c + (int)tind[i].size() > mid * (d+1)) {
ok = false;
break;
}
c = max(0, c+(int)tind[i].size()-mid);
}
//cout << mid << '\n';
if(ok) hi=mid;
else lo=mid;
}
cout << hi;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |