| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 453117 | fuad27 | Job Scheduling (CEOI12_jobs) | C++14 | 798 ms | 17556 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int max = 1e5+50;
vector<pair<int,int>> j;
vector<int> w;
int n,d,m;
queue<int> tmp;
bool check(int md){
queue<int> q = tmp;
int cur = 1,u = 0;
while(q.size()){
int v = q.front();
if(v - d > cur){
cur = v-d;
u = 0;
}
q.pop();
if(cur > v)return 0;
u++;
if(u == md){
u = 0;
cur++;
}
}
return 1;
}
int main(){
cin >> n >> d >> m;
j.resize(m);
for(int i=0;i<m;i++){
cin >> j[i].first;
j[i].second = i;
}
sort(j.begin(),j.end());
for(int i=0;i<m;i++)
tmp.push(j[i].first + d);
int md,lo=1,hi=1e5,ans=1e5;
while(lo <= hi){
md = (lo+hi)/2;
if(check(md)){
hi = md-1;
ans = md;
}else lo = md+1;
}
cout<<ans<<endl;
int u = 0,id=0;
for(int i=0;i<n;i++){
for(int x=0;x<ans;x++){
if(id == m)break;
if(j[id].first - 1 > i)break;
cout<<j[id].second + 1<<' ';
id++;
}
cout<<0<<endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
