# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
157689 | a_player | Job Scheduling (CEOI12_jobs) | C++14 | 378 ms | 7340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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+=T)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);
for(int i=0;i<M;i++)s[i];
int x=-1;
for(int b=M;b>=1;b/=2)
while(!check(x+b))x+=b;
cout<<x+1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |