Submission #1113993

#TimeUsernameProblemLanguageResultExecution timeMemory
1113993ezzzayJob Scheduling (CEOI12_jobs)C++14
0 / 100
404 ms16896 KiB
#include<bits/stdc++.h> using namespace std; #define itn long long #define ff first #define ss second #define int long long #define pb push_back vector<pair<int,int>>v; int n,d,m; bool check(int mid){ int j=0; bool u=1; for(int i=1;i<=n;i++){ int p=mid; while(j<=m){ if(p==0 or v[j].ff>i){ break; } if(i<=v[j].ff+d){ p--; j++; } else{ u=0; break; } } } return (u & (j==m)); } signed main(){ cin>>n>>d>>m; for(int i=1;i<=m;i++){ int x; cin>>x; v.pb({x,i}); } sort(v.begin(),v.end()); int lo=0,hi=1e16; while(hi>=lo){ int mid=(hi+lo)/2; bool u=check(mid); if(u==0){ lo=mid+1; } else{ hi=mid-1; } } cout<<lo<<endl; for(int i=1;i<=n;i++)cout<<0<<endl; } /* 8 2 12 1 2 4 2 1 3 5 6 2 3 6 4 */
#Verdict Execution timeMemoryGrader output
Fetching results...