# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
520321 | 2022-01-29T12:38:03 Z | krit3379 | Job Scheduling (CEOI12_jobs) | C++14 | 135 ms | 7496 KB |
#include<bits/stdc++.h> using namespace std; #define N 1000005 struct A{ int val,i; bool operator<(const A& o)const{ return val<o.val; } }; A a[N]; int main(){ int n,m,d,i,j,l,r,mid,k,ans; scanf("%d %d %d",&n,&d,&m); for(i=1;i<=m;i++){ scanf("%d",&a[i].val); a[i].i=i; } sort(a+1,a+m+1); l=1,r=m; while(l<=r){ mid=(l+r)/2; for(i=1,j=1;i<=n&&j<=m;i++){ if(i>a[j].val+d)break; k=mid; while(j<=m&&a[j].val<=i&&k--)j++; } if(j>m)ans=mid,r=mid-1; else l=mid+1; } printf("%d\n",ans); for(i=1;i<=n;i++)printf("0\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1100 KB | Output is correct |
2 | Correct | 10 ms | 1100 KB | Output is correct |
3 | Correct | 9 ms | 1060 KB | Output is correct |
4 | Correct | 9 ms | 1100 KB | Output is correct |
5 | Correct | 9 ms | 1100 KB | Output is correct |
6 | Correct | 9 ms | 1100 KB | Output is correct |
7 | Correct | 11 ms | 1000 KB | Output is correct |
8 | Correct | 9 ms | 1092 KB | Output is correct |
9 | Correct | 16 ms | 1228 KB | Output is correct |
10 | Correct | 23 ms | 1204 KB | Output is correct |
11 | Correct | 15 ms | 1080 KB | Output is correct |
12 | Correct | 26 ms | 1828 KB | Output is correct |
13 | Correct | 39 ms | 2628 KB | Output is correct |
14 | Correct | 59 ms | 3404 KB | Output is correct |
15 | Correct | 68 ms | 4192 KB | Output is correct |
16 | Correct | 106 ms | 4976 KB | Output is correct |
17 | Correct | 111 ms | 5708 KB | Output is correct |
18 | Correct | 104 ms | 6516 KB | Output is correct |
19 | Correct | 122 ms | 7496 KB | Output is correct |
20 | Correct | 135 ms | 5704 KB | Output is correct |