Submission #791495

# Submission time Handle Problem Language Result Execution time Memory
791495 2023-07-24T07:02:40 Z I_FloPPed21 Job Scheduling (CEOI12_jobs) C++14
55 / 100
253 ms 14220 KB
#include <bits/stdc++.h>

using namespace std;

long long n, d, m ;

struct neveu
{
    int a,  b ;
} v [ 1000005 ];
bool check(long long caz )
{
    int ziua = 1 ;

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

    }

    return true ;
}


bool compare ( neveu x, neveu y)
{
    return ( x. a < y . a );
}
int main()
{
    cin >> n >> d >> m ;

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

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

    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' ;


    long long masini = poz ;
    long long ziua = 1 ;
    for ( int i = 1; i <= m  ; i ++ )
    {
        cout << v [ i ].b << " ";
        masini -- ;

        if ( masini == 0 )
        {
            cout << 0 << '\n';
            masini = poz ;
            ziua ++ ;
        }

    }

    while ( ziua <= n )
    {
        cout << 0 << '\n';
        ziua ++ ;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1740 KB Output isn't correct
2 Incorrect 22 ms 1692 KB Output isn't correct
3 Incorrect 22 ms 1708 KB Output isn't correct
4 Incorrect 25 ms 1700 KB Output isn't correct
5 Incorrect 22 ms 1764 KB Output isn't correct
6 Incorrect 22 ms 1748 KB Output isn't correct
7 Incorrect 34 ms 1756 KB Output isn't correct
8 Incorrect 21 ms 1764 KB Output isn't correct
9 Correct 27 ms 2104 KB Output is correct
10 Correct 28 ms 2104 KB Output is correct
11 Correct 31 ms 1684 KB Output is correct
12 Correct 57 ms 3132 KB Output is correct
13 Correct 84 ms 4572 KB Output is correct
14 Correct 129 ms 6352 KB Output is correct
15 Incorrect 136 ms 7560 KB Output isn't correct
16 Correct 190 ms 9324 KB Output is correct
17 Correct 229 ms 10724 KB Output is correct
18 Correct 214 ms 12116 KB Output is correct
19 Correct 253 ms 14220 KB Output is correct
20 Correct 217 ms 10836 KB Output is correct