답안 #374676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
374676 2021-03-07T20:26:22 Z ritul_kr_singh Job Scheduling (CEOI12_jobs) C++17
55 / 100
409 ms 20844 KB
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << " " <<
#define nl << "\n"

int n, d, m;
array<int, 2> a[1000000];

bool possible(int k){
    for(int i=0; i<m; ++i){
        int best = ((i+1)+k-1)/k;
        if(best>a[i][0]+d) return false;
    }
    return n*k>=m;
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    cin >> n >> d >> m;
    for(int i=0; i<m; ++i) cin >> a[i][0], a[i][1] = i;
    sort(a, a+m);
    int low = 1, high = m;
    while(low<high){
        int mid = (low+high)/2;
        if(possible(mid)) high = mid;
        else low = mid+1;
    }
    cout << low nl;
    int j=0;
    for(int i=0; i<n; ++i){
        int curr=0;
        while(curr+1<=low and j<m and a[j][0]<=i+1){
            cout << a[j][1]+1 << ' ';
            ++j;
            ++curr;
        }
        cout << 0 nl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 2540 KB Output isn't correct
2 Incorrect 35 ms 2540 KB Output isn't correct
3 Incorrect 34 ms 2540 KB Output isn't correct
4 Incorrect 34 ms 2540 KB Output isn't correct
5 Incorrect 33 ms 2540 KB Output isn't correct
6 Incorrect 34 ms 2540 KB Output isn't correct
7 Incorrect 34 ms 2540 KB Output isn't correct
8 Incorrect 34 ms 2540 KB Output isn't correct
9 Correct 48 ms 2668 KB Output is correct
10 Correct 47 ms 2668 KB Output is correct
11 Correct 41 ms 2540 KB Output is correct
12 Correct 85 ms 4844 KB Output is correct
13 Correct 139 ms 7020 KB Output is correct
14 Correct 172 ms 9452 KB Output is correct
15 Incorrect 215 ms 11628 KB Output isn't correct
16 Correct 257 ms 13932 KB Output is correct
17 Correct 306 ms 16332 KB Output is correct
18 Correct 355 ms 18540 KB Output is correct
19 Correct 409 ms 20844 KB Output is correct
20 Correct 307 ms 16108 KB Output is correct