Submission #791566

# Submission time Handle Problem Language Result Execution time Memory
791566 2023-07-24T07:29:22 Z I_FloPPed21 Job Scheduling (CEOI12_jobs) C++14
40 / 100
267 ms 13728 KB
#include <iostream>
#include <algorithm>
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 ;

        if ( ziua > n )
            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 << 50000 << '\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 ++ ;
        }
        else if ( i == m )
        {
            cout << 0 << '\n';
            ziua ++ ;
        }

    }


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

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1620 KB Output is correct
2 Correct 25 ms 1672 KB Output is correct
3 Correct 25 ms 1692 KB Output is correct
4 Correct 24 ms 1660 KB Output is correct
5 Correct 23 ms 1620 KB Output is correct
6 Correct 25 ms 1612 KB Output is correct
7 Correct 24 ms 1660 KB Output is correct
8 Correct 23 ms 1620 KB Output is correct
9 Incorrect 29 ms 1740 KB Output isn't correct
10 Incorrect 30 ms 1852 KB Output isn't correct
11 Incorrect 34 ms 1612 KB Output isn't correct
12 Incorrect 57 ms 3140 KB Output isn't correct
13 Incorrect 89 ms 4572 KB Output isn't correct
14 Incorrect 132 ms 6104 KB Output isn't correct
15 Incorrect 144 ms 7604 KB Output isn't correct
16 Incorrect 204 ms 9032 KB Output isn't correct
17 Incorrect 233 ms 10596 KB Output isn't correct
18 Incorrect 228 ms 12076 KB Output isn't correct
19 Incorrect 267 ms 13728 KB Output isn't correct
20 Incorrect 239 ms 10524 KB Output isn't correct