Submission #522011

#TimeUsernameProblemLanguageResultExecution timeMemory
522011alexz1205Job Scheduling (CEOI12_jobs)C++14
0 / 100
244 ms10500 KiB
#include <iostream> #include <vector> using namespace std; int main() { int n, d, m; cin >> n >> d >> m; vector<int> jobs[n]; for (int x = 0; x < m; x ++){ int a; cin >> a; jobs[a-1].push_back(x); } int lo = 0, hi = m; while (lo <= hi){ int mid = lo + (hi-lo+1)/2; int c = 0; bool pos = true; for (int x = 0; x < n; x ++){ c += jobs[x].size(); c -= mid; c = max(0, c); if (c >= d*mid){ pos = false; break; } } if (pos){ hi = mid-1; }else { lo = mid+1; } } cout << hi+1 << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...