제출 #1270339

#제출 시각아이디문제언어결과실행 시간메모리
1270339victorj0902Job Scheduling (CEOI12_jobs)C++20
0 / 100
77 ms7236 KiB
#include<bits/stdc++.h> using namespace std; struct job{ int time; int idx; bool operator < (const job & other){ return time < other.time; } }; job a[1000010]; int n, m, d; bool check(int k){ int curtime = 1; for(int i = 1; i <= m; i+=k){ if(a[i].time < curtime){ return false; } curtime++; } return true; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> d >> m; for(int i = 1; i <= m; i++){ cin >> a[i].time; a[i].time += d; a[i].idx = i; } sort(a+1, a+m+1); int l = 1, r = n; int mid; int ans = n; while(l <= r){ mid = (l+r)/2; if(check(mid) == true){ ans = mid; r = mid-1; }else{ l = mid+1; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...