답안 #791563

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
791563 2023-07-24T07:28:42 Z I_FloPPed21 Job Scheduling (CEOI12_jobs) C++14
0 / 100
1 ms 328 KB
#include <fstream>
#include <algorithm>
using namespace std;
ifstream cin("jobs.in");
ofstream cout("jobs.out");
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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
3 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
4 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
5 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
6 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
7 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
8 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
9 Incorrect 1 ms 328 KB Unexpected end of file - int32 expected
10 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
11 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
12 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
13 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
14 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
15 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
16 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
17 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
18 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
19 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
20 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected