# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1168410 | ffeyyae | Job Scheduling (CEOI12_jobs) | C++20 | 141 ms | 13656 KiB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+5;
int n, d, m;
vector<int> keep[N];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> d >> m;
for( int i=1;i<=m;i++ )
{
int a; cin >> a;
keep[a].push_back( i );
}
int l = 1, r = m;
while( l<r )
{
int mid = (l+r)/2;
bool chk = false;
queue<int> q;
for( int i=1;i<=n;i++ )
{
if( !q.empty() && q.front()<i-d )
{
chk = true;
break;
}
for( int j=0;j<keep[i].size();j++ ) q.push( i );
for( int j=0;j<mid && !q.empty();j++ ) q.pop();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |