답안 #791568

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
791568 2023-07-24T07:29:52 Z I_FloPPed21 Job Scheduling (CEOI12_jobs) C++14
55 / 100
259 ms 13724 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 << 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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 1644 KB Output isn't correct
2 Incorrect 30 ms 1596 KB Output isn't correct
3 Incorrect 23 ms 1584 KB Output isn't correct
4 Incorrect 24 ms 1600 KB Output isn't correct
5 Incorrect 24 ms 1620 KB Output isn't correct
6 Incorrect 23 ms 1620 KB Output isn't correct
7 Incorrect 23 ms 1620 KB Output isn't correct
8 Incorrect 24 ms 1680 KB Output isn't correct
9 Correct 36 ms 1776 KB Output is correct
10 Correct 32 ms 1740 KB Output is correct
11 Correct 29 ms 1620 KB Output is correct
12 Correct 57 ms 3124 KB Output is correct
13 Correct 85 ms 4632 KB Output is correct
14 Correct 133 ms 6044 KB Output is correct
15 Incorrect 147 ms 7524 KB Output isn't correct
16 Correct 196 ms 9036 KB Output is correct
17 Correct 226 ms 10508 KB Output is correct
18 Correct 255 ms 12060 KB Output is correct
19 Correct 259 ms 13724 KB Output is correct
20 Correct 228 ms 10572 KB Output is correct