Submission #791454

# Submission time Handle Problem Language Result Execution time Memory
791454 2023-07-24T06:41:44 Z I_FloPPed21 Job Scheduling (CEOI12_jobs) C++17
55 / 100
174 ms 7460 KB
#include <bits/stdc++.h>

using namespace std;

long long n, d, m ;
long long v [ 1000005 ];

bool check(long long caz )
{
    int ziua = 1 ;

    for ( int i = 1; i <= m ; i += caz, ziua ++  )
    {
        if ( v[ i ] < ziua )
            return false ;

    }

    return true ;
}
int main()
{
    cin >> n >> d >> m ;

    for ( int i = 1; i <= m ; i ++ )
    {
        cin >> v[ i ] ;
        v [ i ] += d ;
    }

    sort ( v + 1, v + m  + 1) ;

    long long poz = 1e9 ;

    int st = 1, dr = m ;

    while ( st <= dr )
    {
        long long mij = ( st + dr ) / 2 ;
        if ( check ( mij ) == true )
        {
            poz = mij ;
            dr = mij - 1;
        }
        else
            st = mij + 1;
    }

    cout << poz << '\n' ;


    for ( int i = 1; i <= n ; i ++ )
        cout << 0 << '\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1108 KB Output isn't correct
2 Incorrect 14 ms 1100 KB Output isn't correct
3 Incorrect 15 ms 1092 KB Output isn't correct
4 Incorrect 14 ms 1108 KB Output isn't correct
5 Incorrect 15 ms 1108 KB Output isn't correct
6 Incorrect 14 ms 1024 KB Output isn't correct
7 Incorrect 14 ms 980 KB Output isn't correct
8 Incorrect 15 ms 1004 KB Output isn't correct
9 Correct 24 ms 1368 KB Output is correct
10 Correct 20 ms 1252 KB Output is correct
11 Correct 19 ms 1044 KB Output is correct
12 Correct 37 ms 1752 KB Output is correct
13 Correct 56 ms 2632 KB Output is correct
14 Correct 91 ms 3368 KB Output is correct
15 Incorrect 104 ms 4112 KB Output isn't correct
16 Correct 145 ms 4936 KB Output is correct
17 Correct 158 ms 5688 KB Output is correct
18 Correct 150 ms 6468 KB Output is correct
19 Correct 174 ms 7460 KB Output is correct
20 Correct 161 ms 5688 KB Output is correct