# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
333378 | siddarthm | Job Scheduling (CEOI12_jobs) | C++11 | 304 ms | 2668 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
using namespace std;
pair<int,int> orders[100000];
int n,d,m;
int backlog[100000];
bool works(int x)
{
//cout << x << endl;
for(int i=0; i<x; i++)
{
backlog[i] = 0;
}
for(int i=0; i<m; i++)
{
int current = (i/x)+1;
if(current>(orders[i].first+x))
return false;
}
return true;
}
int main(){
cin >> n >> d >> m;
for(int i=0; i<m; i++)
{
cin >> orders[i].first;
orders[i].second = i+1;
}
sort(orders, orders+m);
int a = 1;
int b = m;
while(a!=b)
{
int mid = (a+b)/2;
if(works(mid))
b = mid;
else
a = mid+1;
cout << endl;
}
cout << a << endl;
int counter = 0;
for(int i=0; i<n; i++)
{
for(int j=0; j<a; j++)
{
if(counter==m)
continue;
cout << orders[counter].second << " ";
counter++;
}
cout << 0 << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |