Submission #1135313

#TimeUsernameProblemLanguageResultExecution timeMemory
1135313MunkhturErdenebatJob Scheduling (CEOI12_jobs)C++20
55 / 100
124 ms9336 KiB
#include<bits/stdc++.h> #include<string.h> #include <algorithm> #include <stdlib.h> #define ll long long using namespace std; ll a,b,c,d,e,f,m,i,j,n,h,g,l,r,ka,p,q[200005],t[200005]; map<ll,ll> maa,mii,mee; vector<ll> vas[25],vis,vii; pair<ll,ll> k[200006]; int main(){ cin>>a>>b>>c; for(i=0 ; i<c; i++){ cin>>k[i].first; k[i].second=i+1; } sort(k,k+c); l=1; r=c; while(l<r){ m=(l+r-1)/2; g=0; h=0; ka=1; for(i=0 ; i<c ; i++){ if(k[i].first>ka){ h=0; ka=k[i].first; continue; } if(k[i].first<=ka && k[i].first+b>=ka){ h++; } if(h==m){ h=0; ka++; } if(k[i].first+b<ka){ g=1; break; } } if(g==1 || ka>a){ l=m+1; } else{ r=m; } } cout<<l<<endl; h=0; ka=1; g=0; for(i=0 ; i<c ; i++){ if(k[i].first>ka){ h=0; ka++; cout<<0<<endl; continue; } if(k[i].first<=ka && k[i].first+b>=ka){ h++; cout<<k[i].second<<" "; } if(h==m){ h=0; cout<<0<<endl; ka++; } } a-=ka; a++; while(a--){ cout<<0<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...