답안 #48415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48415 2018-05-12T22:24:17 Z updown1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
151 ms 4180 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, M)
#define ffa ffi ffj
#define s <<" "<<
#define w cout
#define e "\n"
#define pb push_back
#define mp make_pair
#define a first
#define b second
//#define int ll
const int MAXN=1000000;//, INF=1000000000000000000;
///500,000,000
int D, N, inp[MAXN];

bool works(int m) {
    int day = 1;
    int lef = m;
    ffi {
        if (inp[i] > day) day=inp[i], lef = m;
        if (inp[i] + D < day) return false;
        lef--;
        if (lef == 0) day++, lef=m;
    }
    return true;
}

int main() {
    //ifstream cin("test.in");
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> D >> N;
    ffi cin >> inp[i];
    sort(inp, inp+N);
    int a=1, b=N;
    while (a != b) {
        int mid = (a+b)/2;
        if (works(mid)) b = mid;
        else a = mid+1;
    }
    w<< a<<e;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 760 KB Unexpected end of file - int32 expected
2 Incorrect 13 ms 872 KB Unexpected end of file - int32 expected
3 Incorrect 12 ms 872 KB Unexpected end of file - int32 expected
4 Incorrect 13 ms 872 KB Unexpected end of file - int32 expected
5 Incorrect 13 ms 872 KB Unexpected end of file - int32 expected
6 Incorrect 13 ms 872 KB Unexpected end of file - int32 expected
7 Incorrect 13 ms 880 KB Unexpected end of file - int32 expected
8 Incorrect 13 ms 880 KB Unexpected end of file - int32 expected
9 Incorrect 16 ms 980 KB Unexpected end of file - int32 expected
10 Incorrect 15 ms 980 KB Unexpected end of file - int32 expected
11 Incorrect 19 ms 980 KB Unexpected end of file - int32 expected
12 Incorrect 35 ms 1336 KB Unexpected end of file - int32 expected
13 Incorrect 50 ms 1720 KB Unexpected end of file - int32 expected
14 Incorrect 82 ms 2128 KB Unexpected end of file - int32 expected
15 Incorrect 85 ms 2592 KB Unexpected end of file - int32 expected
16 Incorrect 116 ms 2956 KB Unexpected end of file - int32 expected
17 Incorrect 135 ms 3284 KB Unexpected end of file - int32 expected
18 Incorrect 136 ms 3664 KB Unexpected end of file - int32 expected
19 Incorrect 151 ms 4180 KB Unexpected end of file - int32 expected
20 Incorrect 140 ms 4180 KB Unexpected end of file - int32 expected