# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
502062 | forevpurity | Job Scheduling (CEOI12_jobs) | C++14 | 243 ms | 16856 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
//freopen("socdist.in", "r", stdin);
//freopen("socdist.out", "w", stdout);
int n, d, m;
cin >> n >> d >> m;
vector<pair<int,int>> v(m);
for (int i = 0; i < m; i++){
cin >> v[i].first;
v[i].second = i;
}
sort(v.begin(), v.end());
int l = 1, r = 1e6;
while(l < r){
int x = l + (r - l)/2;
bool check = 1;
int p = 0;
for (int i = 1; i <= n; i++){
int cur = 0;
while (p < m && v[p].first <= i && cur < x){
if (i - v[p].first > d) check = 0;
p++;
cur++;
}
}
if (check) r = x;
else l = x + 1;
}
int machines = l;
int p = 0;
for (int i = 1; i <= n; i++){
int cur = 0;
while (p < m && v[p].first <= i && cur < machines){
cout << v[p].second + 1 << " ";
p++;
cur++;
}
cout << 0 << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |