# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
374685 | ritul_kr_singh | Job Scheduling (CEOI12_jobs) | C++17 | 344 ms | 20972 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << " " <<
#define nl << "\n"
int n, d, m;
array<int, 2> a[1000000];
bool possible(int k){
int j=0;
for(int i=0; i<n; ++i){
int curr=0;
while(curr+1<=k and j<m and a[j][0]<=i+1 and i+1<=a[j][0]+d){
++j;
++curr;
}
}
return j==m;
}
signed main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> d >> m;
for(int i=0; i<m; ++i) cin >> a[i][0], a[i][1] = i;
sort(a, a+m);
int low = 1, high = 1e9;
while(low<high){
int mid = (low+high)/2;
if(possible(mid)) high = mid;
else low = mid+1;
}
cout << low nl;
int j=0;
for(int i=0; i<n; ++i){
int curr=0;
while(curr+1<=low and j<m and a[j][0]<=i+1){
cout << a[j][1]+1 << ' ';
++j;
++curr;
}
cout << 0 nl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |