Submission #48414

# Submission time Handle Problem Language Result Execution time Memory
48414 2018-05-12T22:23:38 Z updown1 Job Scheduling (CEOI12_jobs) C++17
0 / 100
151 ms 4052 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;
}

Compilation message

jobs.cpp:16:29: warning: overflow in implicit constant conversion [-Woverflow]
 const int MAXN=1000000, INF=1000000000000000000;
                             ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 760 KB Unexpected end of file - int32 expected
2 Incorrect 12 ms 828 KB Unexpected end of file - int32 expected
3 Incorrect 13 ms 828 KB Unexpected end of file - int32 expected
4 Incorrect 13 ms 832 KB Unexpected end of file - int32 expected
5 Incorrect 13 ms 876 KB Unexpected end of file - int32 expected
6 Incorrect 23 ms 928 KB Unexpected end of file - int32 expected
7 Incorrect 22 ms 1056 KB Unexpected end of file - int32 expected
8 Incorrect 23 ms 1056 KB Unexpected end of file - int32 expected
9 Incorrect 25 ms 1056 KB Unexpected end of file - int32 expected
10 Incorrect 15 ms 1056 KB Unexpected end of file - int32 expected
11 Incorrect 19 ms 1056 KB Unexpected end of file - int32 expected
12 Incorrect 39 ms 1440 KB Unexpected end of file - int32 expected
13 Incorrect 51 ms 1724 KB Unexpected end of file - int32 expected
14 Incorrect 78 ms 2112 KB Unexpected end of file - int32 expected
15 Incorrect 84 ms 2492 KB Unexpected end of file - int32 expected
16 Incorrect 114 ms 2900 KB Unexpected end of file - int32 expected
17 Incorrect 137 ms 3356 KB Unexpected end of file - int32 expected
18 Incorrect 139 ms 3668 KB Unexpected end of file - int32 expected
19 Incorrect 151 ms 4052 KB Unexpected end of file - int32 expected
20 Incorrect 147 ms 4052 KB Unexpected end of file - int32 expected