답안 #743317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
743317 2023-05-17T09:46:16 Z vjudge1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
16 ms 1636 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] > mid) 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;
    for(int i=1;i<=n;i++) cout << "0\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1248 KB Output isn't correct
2 Incorrect 5 ms 1236 KB Output isn't correct
3 Incorrect 5 ms 1236 KB Output isn't correct
4 Incorrect 5 ms 1312 KB Output isn't correct
5 Incorrect 5 ms 1236 KB Output isn't correct
6 Incorrect 6 ms 1236 KB Output isn't correct
7 Incorrect 6 ms 1348 KB Output isn't correct
8 Incorrect 4 ms 1236 KB Output isn't correct
9 Incorrect 15 ms 1636 KB Output isn't correct
10 Incorrect 16 ms 1632 KB Output isn't correct
11 Incorrect 4 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 1 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 2 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 1236 KB Execution killed with signal 11
20 Runtime error 2 ms 468 KB Execution killed with signal 11