답안 #743318

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