| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1296720 | Sunbae | Job Scheduling (CEOI12_jobs) | C++17 | 137 ms | 16916 KiB |
#include <bits/stdc++.h>
using namespace std;
vector<int> e[100000];
signed main(){
int n, d, m; scanf("%d %d %d", &n, &d, &m);
for(int i = 0, x; i<m; ++i) scanf("%d", &x), e[--x].push_back(i);
int low = 1, high = m, ans;
queue<int> q;
while(low <= high){
int mid = (low + high)>>1;
while(!q.empty()) q.pop();
for(int d = 0; d<n; ++d){
for(int x: e[d]) q.push(x);
for(int i = 0; !q.empty() && i<mid; ++i) q.pop();
}
if(q.size()/mid <= d) high = (ans = mid)-1;
else low = mid+1;
}
printf("%d\n", ans);
while(!q.empty()) q.pop();
for(int d = 0; d<n; ++d){
for(int x: e[d]) q.push(x);
for(int i = 0; !q.empty() && i<ans; ++i) printf("%d ", q.front()+1), q.pop();
puts("0");
}
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
