# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1172630 | nguyenkhangninh99 | Job Scheduling (CEOI12_jobs) | C++17 | 166 ms | 40268 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 1e6 + 5;
vector<int> day[maxn];
int n, d, m;
bool ok(int mid){
queue<int> q;
for(int i = 1; i <= n; i++){
if(q.size() && q.front() < i - d) return false;
for(int x: day[i]) q.push(x);
for(int j = 0; j < mid && q.size(); j++) q.pop();
}
return true;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> d >> m;
for(int i = 1; i <= m; i++){
int x; cin >> x;
day[x].push_back(i);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |