답안 #52111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52111 2018-06-24T01:52:15 Z mra2322001 Job Scheduling (CEOI12_jobs) C++14
0 / 100
119 ms 34004 KB
#include <bits/stdc++.h>
#define f0(i, n) for(int i=(0); i<(n); i++)
#define f1(i, n) for(int i=(1); i<=(n); i++)

using namespace std;
typedef long long ll;
const int N = 1000002;

int n, d, m, dd[N];
pair <int, int> a[N];

bool check(int x){
    f1(i, n) dd[i] = 0;
    bool ok = 1;
    for(int i = m; i >= 1; i--){
        ok = 0;
        for(int j = a[i].second; j >= a[i].first; j--){
            if(dd[j] < x){
                dd[j]++;
                ok = 1;
                break;
            }
        }
        if(!ok) return 0;
    }
    return 1;
}

int main(){
    ios_base::sync_with_stdio(0);
   
    cin >> n >> d >> m;
    f1(i, m){
        int x; cin >> x;
        a[i] = make_pair(i, i + d - 1);
    }
    int l = 0, r = m;
    sort(a + 1, a + n + 1, [&](pair <int, int> a1, pair <int, int> a2){
         if(a1.second != a2.second) return a1.second < a2.second;
         return a1.first < a2.first;
    });

    int ans = m;
    while(l <= r){
        int mid = (l + r)/2;
        if(check(mid)) r = mid - 1, ans = mid;
        else l = mid + 1;
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 1784 KB Output isn't correct
2 Incorrect 13 ms 2212 KB Output isn't correct
3 Incorrect 14 ms 2444 KB Output isn't correct
4 Incorrect 13 ms 2900 KB Output isn't correct
5 Incorrect 13 ms 3276 KB Output isn't correct
6 Incorrect 13 ms 3504 KB Output isn't correct
7 Incorrect 14 ms 3952 KB Output isn't correct
8 Incorrect 14 ms 4112 KB Output isn't correct
9 Incorrect 18 ms 4444 KB Output isn't correct
10 Incorrect 18 ms 4660 KB Output isn't correct
11 Incorrect 15 ms 4992 KB Output isn't correct
12 Incorrect 26 ms 6992 KB Output isn't correct
13 Incorrect 38 ms 9264 KB Output isn't correct
14 Incorrect 62 ms 12496 KB Output isn't correct
15 Incorrect 64 ms 15444 KB Output isn't correct
16 Incorrect 83 ms 19624 KB Output isn't correct
17 Incorrect 95 ms 24128 KB Output isn't correct
18 Incorrect 106 ms 28368 KB Output isn't correct
19 Incorrect 119 ms 33044 KB Output isn't correct
20 Incorrect 95 ms 34004 KB Output isn't correct