| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 97645 | dalgerok | Job Scheduling (CEOI12_jobs) | C++14 | 286 ms | 13752 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, d, m;
pair < int, int > a[N];
inline bool check(int x){
int i = 1, day = 0;
while(i <= m){
day += 1;
int j = i;
while(j <= min(m, i + x - 1) && day >= a[j].first){
if(a[j].first + d < day){
return false;
}
j += 1;
}
i = j;
}
return true;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> d >> m;
for(int i = 1; i <= m; i++){
cin >> a[i].first;
a[i].second = i;
}
sort(a + 1, a + m + 1);
int l = 1, r = m;
while(l < r){
int mid = (r + l) >> 1;
if(check(mid)){
r = mid;
}
else{
l = mid + 1;
}
}
cout << l << "\n";
int i = 1, day = 0;
for(int it = 1; it <= n; it++){
day += 1;
int j = i;
while(j <= min(m, i + l - 1) && day >= a[j].first){
cout << a[j].second << " ";
j += 1;
}
cout << "0\n";
i = j;
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
