# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1165041 | danieldsw | Job Scheduling (CEOI12_jobs) | C++20 | 155 ms | 13656 KiB |
#define ll long long
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int n,d,j; cin >> n >> d >> j;
vector<vector<int>> nums(n);
int num;
for (int i =0; i < j; i++){
cin >> num;
nums[num-1].push_back(i);
}
int l = 1, r = j, m;
bool a;
int sol = j;
queue<int> q;
while (l <= r){
m = (l+r)/2;
a = true;
q = {};
for (int i = 0; i < n; i++){
for (int x = 0; x < nums[i].size(); x++){
q.push(nums[i][x]+d);
}
for (int f = 0; f < m; f++){
if (q.empty()){break;}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |