제출 #157693

#제출 시각아이디문제언어결과실행 시간메모리
157693a_playerJob Scheduling (CEOI12_jobs)C++14
0 / 100
454 ms3784 KiB
#include <bits/stdc++.h>

using namespace std;

int N,M,D;
int s[1000001];
bool check(int T){
  if(T>=M)return true;
  if(T==0)return false;
     for(int i=0;i<M;i++)if(s[i]+D<i/T+1)return false;
     return true;
}
int main(){
  cin>>N>>D>>M;
  for(int i=0;i<M;i++)cin>>s[i];
  sort(s,s+M);
  int x=-1;
  for(int b=M;b>=1;b/=2)
  while(!check(x+b))x+=b;

  cout<<x+1;

}
#Verdict Execution timeMemoryGrader output
Fetching results...