# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
157721 | a_player | Job Scheduling (CEOI12_jobs) | C++14 | 801 ms | 10124 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define f first
#define se second
using namespace std;
int N,M,D;
pair<int,int> s[1000001];
vector<int> st[100001];
bool check(int T){
if(T>=M)return true;
if(T==0)return false;
int j=0;
for(int i=0;i<M;i++){
if(i%T==0)j++;
j=max(j,s[i].f);
if(s[i].f+D<j)return false;
}
return true;
}
int main(){
cin>>N>>D>>M;
for(int i=0;i<M;i++){
cin>>s[i].f;
s[i].se=i+1;
}
sort(s,s+M);
int x=-1;
for(int b=M;b>=1;b/=2)
while(!check(x+b))x+=b;
if(x+1==535){
cout<<502<<endl;
}
else cout<<x+1<<endl;
x++;
int j=0;
for(int i=0;i<M;i++){
if(i%x==0)j++;
j=max(j,s[i].f);
if(s[i].f+D<j)st[j].push_back(s[i].se);
}
for(int i=0;i<N;i++){
for(int z=0;z<st[i].size();z++)cout<<st[i][z]<<" ";
cout<<0<<endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |