# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
853170 | mall0809 | Job Scheduling (CEOI12_jobs) | C++17 | 310 ms | 13868 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define __gcd() gcd()
#define C int(1e5+7)
#define M int(1e9+7)
#define el '\n'
#define all(a) a.begin(),a.end()
#define pb push_back
using namespace std;
typedef long long ll;
int main(){
//ios_base::sync_with_stdio(false);
//cin.tie(0);cout.tie(0);
//freopen("","r",stdin);
//freopen("","w",stdout);
int n,d,m;cin>>n>>d>>m;
vector<array<int,2>> a(m);for(int i=0;i<m;i++)cin>>a[i][0],a[i][1] = i;
sort(all(a));
int l=1,r=1e7;
auto check = [&](int mid){
int id = 0,cnt=mid;
for(int i=1;i<=n && id < m;i++){
if(i > a[id][0] + d)return false;
while(id < m && a[id][0] <= i && cnt>=1)cnt--,id++;
cnt = mid;
}
return true;
};
while(l<r){
int mid=(l+r)/2;
if(check(mid))r=mid;
else l=mid+1;
}
cout<<r<<el;
int cnt = r;
for(int i=1,id=0;i<=n;i++){
while(id < m && a[id][0] <= i && cnt >= 1){
cout<<a[id][1]+1<<' ';
cnt--,id++;
}
cnt = r;
cout<<0<<el;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |