Submission #743325

# Submission time Handle Problem Language Result Execution time Memory
743325 2023-05-17T09:49:20 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
15 ms 1644 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
const int M = 1e6 + 1;
int dp[N] , arr[M] , pre[N];
int n,m,d;
bool solve(int mid) {
    for(int i=1;i<=n;i++) dp[i] = 0, pre[i] = i;
    for(int i=1;i<=m;i++) dp[arr[i]]++;
    for(int i=1;i<=m;i++) {
        if (dp[i] > mid) {
            if ((i+1)-pre[i] > d) return false;
            pre[i+1] = pre[i];
            dp[i+1] += dp[i] - mid;
        }
    }
    return dp[m+1]==0;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin >> m >> d >> n;
    for(int i=1;i<=m;i++) cin >> arr[i];
    int l = 1 , r = N;
    while (l < r) {
        int mid = (l + r) / 2;
        if (solve(mid)) r = mid;
        else l = mid + 1;
    }
    cout << l << '\n';
    for(int i=1;i<=n;i++) cout << "0\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 1236 KB Output isn't correct
2 Incorrect 5 ms 1236 KB Output isn't correct
3 Incorrect 6 ms 1236 KB Output isn't correct
4 Incorrect 5 ms 1312 KB Output isn't correct
5 Incorrect 5 ms 1248 KB Output isn't correct
6 Incorrect 7 ms 1352 KB Output isn't correct
7 Incorrect 5 ms 1236 KB Output isn't correct
8 Incorrect 5 ms 1236 KB Output isn't correct
9 Incorrect 15 ms 1644 KB Output isn't correct
10 Incorrect 14 ms 1620 KB Output isn't correct
11 Incorrect 3 ms 1236 KB Output isn't correct
12 Runtime error 1 ms 468 KB Execution killed with signal 11
13 Runtime error 1 ms 468 KB Execution killed with signal 11
14 Runtime error 2 ms 468 KB Execution killed with signal 11
15 Runtime error 1 ms 468 KB Execution killed with signal 11
16 Runtime error 1 ms 468 KB Execution killed with signal 11
17 Runtime error 1 ms 468 KB Execution killed with signal 11
18 Runtime error 2 ms 468 KB Execution killed with signal 11
19 Runtime error 7 ms 1216 KB Execution killed with signal 11
20 Runtime error 1 ms 468 KB Execution killed with signal 11