# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1168384 | ffeyyae | Job Scheduling (CEOI12_jobs) | C++20 | 86 ms | 17736 KiB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+5;
ll n, m, d;
vector<ll> keep[N];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> d >> m;
for( int i=1;i<=m;i++ )
{
ll a; cin >> a;
keep[a].push_back( i );
}
ll l = 0, r = n-d;
while( l<r )
{
ll mid = (l+r)/2;
ll temp = 0, cnt = 1;
for( int i=1;i<=n-d;i++ )
{
for( auto x : keep[i] )
{
if( temp+1 > mid )
{
temp = 0;
cnt++;
}
temp++;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |