답안 #374874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
374874 2021-03-08T11:56:28 Z Aryan_Raina Job Scheduling (CEOI12_jobs) C++14
30 / 100
410 ms 22572 KB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define ld long double
#define ar array

const int INF = 1e15;
const int MOD = 1e9+7;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, d, m; cin>>n>>d>>m;
    vector<ar<int,2>> a(m);
    for (int i = 0; i < m; i++) {
        cin>>a[i][0]; a[i][1] = i+1;
    }
    sort(a.begin(), a.end());

    auto check = [&](int x) {
        if ((m+x-1)/x >= n) return false;
        vector<int> time(x, 0);
        for (int i = 0; i < m; i++) {
            if (time[i % x] - a[i][0] >= d) return false;
            time[i % x] = max(time[i % x], a[i][0]) + 1;
        }
        return true;
    };

    int lo = 0, hi = m, mid;
    while (lo + 1 < hi) {
        mid = (lo + hi)>>1;
        if (check(mid)) hi = mid;
        else lo = mid;
    }   
    cout<<hi<<"\n";
    for (int i = 0, j = 0; i < n; i++) {
        for (int k = j; j < min(k+hi,m); j++) cout<<a[j][1]<<" ";
        cout<<"0\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 3324 KB Output isn't correct
2 Incorrect 35 ms 3324 KB Output isn't correct
3 Incorrect 35 ms 3324 KB Output isn't correct
4 Incorrect 34 ms 3324 KB Output isn't correct
5 Incorrect 38 ms 3324 KB Output isn't correct
6 Incorrect 36 ms 3324 KB Output isn't correct
7 Incorrect 35 ms 3324 KB Output isn't correct
8 Incorrect 35 ms 3324 KB Output isn't correct
9 Incorrect 40 ms 2916 KB Output isn't correct
10 Incorrect 44 ms 2916 KB Output isn't correct
11 Correct 40 ms 2660 KB Output is correct
12 Incorrect 83 ms 5208 KB Output isn't correct
13 Correct 122 ms 7636 KB Output is correct
14 Incorrect 172 ms 10060 KB Output isn't correct
15 Incorrect 216 ms 12612 KB Output isn't correct
16 Correct 258 ms 14984 KB Output is correct
17 Correct 303 ms 17460 KB Output is correct
18 Correct 386 ms 20016 KB Output is correct
19 Incorrect 410 ms 22572 KB Output isn't correct
20 Correct 300 ms 17460 KB Output is correct