# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
260552 | kshitij_sodani | Job Scheduling (CEOI12_jobs) | C++14 | 423 ms | 16984 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
int n,d;
int m;
vector<int> ac[100001];
bool check(int mid,int xx=0){
int cur=1;
int le=mid;
for(int j=1;j<=n;j++){
for(auto jj:ac[j]){
if(cur>j+d){
return false;
}
le-=1;
if(xx){
cout<<jj+1<<" ";
}
if(le==0){
if(xx){
cout<<0<<endl;
}
cur+=1;
le=mid;
}
}
if(cur==j){
if(xx){
cout<<0<<endl;
}
cur+=1;
le=mid;
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>d>>m;
for(int i=0;i<m;i++){
int bb;
cin>>bb;
ac[bb].pb(i);
}
int low=1;
int high=m;
while(low<high-1){
int mid=(low+high)/2;
if(check(mid)){
high=mid;
}
else{
low=mid;
}
}
int ans=high;
if(check(low)){
ans=min(ans,low);
}
cout<<ans<<endl;
check(ans,1);
return 0;
}
/*
8 2 12
1 2 4 2 1 3 5 6 2 3 6 4
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |