제출 #667035

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6670352022-11-30 08:23:19hanlei35Job Scheduling (CEOI12_jobs)C++17
70 / 100
1095 ms19112 KiB
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int N, D, M;
pair<int,int> jobs[1000005];
bool check(int m){
int maxD = -1;
int j = 0;
multiset<int> delayed;
for(int i=0;i<N;i++){
while(j!=M&&jobs[j].first==i+1){
delayed.insert(i+1);
j++;
}
int count = 0;
while(count!=m&&!delayed.empty()){
maxD = max(maxD,i+1-*delayed.begin());
delayed.erase(delayed.begin());
count++;
}
}
if(maxD > D) return true;
return false;
}
int search(){
int ans = 0;
for(int val = M; val >= 1; val /= 2){
while(ans+val <= M && check(ans+val)) ans += val;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...