# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869701 | Frozenberrys | Job Scheduling (CEOI12_jobs) | C++17 | 179 ms | 6588 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
using namespace std;
int main()
{
int n, i, j, k, l, o, p, m, d, q;
cin >> n >> d >> q;
int arr[n-d] { 0 };
vector<int> v;
for( i = 0; i < q; i++){
cin >> k;
v.push_back(k);
arr[k-1]++;
}
sort(v.begin(), v.end());
int ans;
if(q%(n-d)==0){ ans = q/(n-d); } else { ans = q/(n-d)+1; }
int count = 0; // first processed
for( i = 0; i < n-d; i++){
count += arr[i];
if( count > d * ans ){ ans += count - d * ans; }
count -= ans;
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |