| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 392783 | nicolaalexandra | Job Scheduling (CEOI12_jobs) | C++14 | 506 ms | 20164 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define DIM 1000010
#define DIMN 100010
using namespace std;
priority_queue <int,vector<int>,greater<int> > h;
pair <int,int> v[DIM];
vector <int> ans[DIMN];
int n,d,m,i;
int main (){
//ifstream cin ("date.in");
//ofstream cout ("date.out");
cin>>m>>d>>n;
for (i=1;i<=n;i++){
cin>>v[i].first;
v[i].second = i;
}
sort (v+1,v+n+1);
h.push(1);
for (i=1;i<=n;i++){
int day = h.top();
if (day > v[i].first + d){
/// mai adaug o masina
h.push(v[i].first+1);
ans[v[i].first].push_back(v[i].second);
} else {
h.pop();
ans[max(day,v[i].first)].push_back(v[i].second);
h.push(max(day+1,v[i].first+1));
}
}
cout<<h.size()<<"\n";
for (i=1;i<=m;i++){
for (auto it : ans[i])
cout<<it<<" ";
cout<<"0\n";
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
