Submission #791540

# Submission time Handle Problem Language Result Execution time Memory
791540 2023-07-24T07:15:26 Z I_FloPPed21 Job Scheduling (CEOI12_jobs) C++14
55 / 100
263 ms 13708 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 ;

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

    }


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

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 1620 KB Output isn't correct
2 Incorrect 24 ms 1604 KB Output isn't correct
3 Incorrect 24 ms 1592 KB Output isn't correct
4 Incorrect 23 ms 1620 KB Output isn't correct
5 Incorrect 23 ms 1620 KB Output isn't correct
6 Incorrect 26 ms 1600 KB Output isn't correct
7 Incorrect 24 ms 1680 KB Output isn't correct
8 Incorrect 24 ms 1696 KB Output isn't correct
9 Correct 29 ms 1804 KB Output is correct
10 Correct 36 ms 1844 KB Output is correct
11 Correct 29 ms 1620 KB Output is correct
12 Correct 58 ms 3060 KB Output is correct
13 Correct 89 ms 4684 KB Output is correct
14 Correct 130 ms 6100 KB Output is correct
15 Incorrect 147 ms 7548 KB Output isn't correct
16 Correct 196 ms 9096 KB Output is correct
17 Correct 228 ms 10492 KB Output is correct
18 Correct 228 ms 12044 KB Output is correct
19 Correct 263 ms 13708 KB Output is correct
20 Correct 228 ms 10572 KB Output is correct