답안 #898828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
898828 2024-01-05T07:16:59 Z hadi7 Job Scheduling (CEOI12_jobs) C++17
35 / 100
406 ms 13856 KB
#include<bits/stdc++.h>
#define FAST ios::sync_with_stdio(0); cin.tie(0)
#define f first
#define s second
using namespace std ;

const int N = 2e6 ;
int n , k , m ;
vector <pair <int , int>> p ;

bool slv(int x)
{
    int u = 0 ;
    for(int i = 1 ; i <= n ; i++)
    {
        for(int j = 0 ; j < x ; j++)
        {
            while(p[u].f > i)
                i++ ;

            if(p[u].f > i + k)
                return 0 ;

            u++ ;

            if(u == m)
                return 1 ;
        }
    }

    return 0 ;
}
main()
{
    cin >> n >> k >> m ;
    p.resize(m) ;

    for(int i = 0 ; i < m ; i++)
    {
        cin >> p[i].f ;
        p[i].s = i + 1 ;
    }

    sort(p.begin() , p.end()) ;

    int l = 0 , r = N ;
    while(l + 1 < r)
    {
        int h = l + (r - l) / 2 ;
        if(slv(h))
            r = h ;
        else
            l = h ;
    }

    cout << r << endl ;

    int z = 0 ;
    for(int i = 0 ; i < m ;)
    {
        for(int j = 0 ; j < r && i < m ; j++ , i++)
        {
            cout << p[i].s << " " ;
        }
        cout << 0 << endl ;
        z++ ;
    }

    for(; z < n ; z++)
        cout << 0 << endl ;
}

Compilation message

jobs.cpp:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   33 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 1624 KB Output isn't correct
2 Incorrect 35 ms 1740 KB Output isn't correct
3 Incorrect 40 ms 1776 KB Output isn't correct
4 Incorrect 36 ms 1752 KB Output isn't correct
5 Incorrect 36 ms 1820 KB Output isn't correct
6 Incorrect 34 ms 1692 KB Output isn't correct
7 Incorrect 34 ms 1732 KB Output isn't correct
8 Incorrect 35 ms 1628 KB Output isn't correct
9 Incorrect 143 ms 1896 KB Output isn't correct
10 Incorrect 142 ms 2132 KB Output isn't correct
11 Correct 33 ms 1624 KB Output is correct
12 Correct 65 ms 3160 KB Output is correct
13 Correct 96 ms 4692 KB Output is correct
14 Correct 161 ms 6044 KB Output is correct
15 Incorrect 163 ms 7508 KB Output isn't correct
16 Correct 220 ms 9292 KB Output is correct
17 Correct 264 ms 10512 KB Output is correct
18 Incorrect 275 ms 12116 KB Output isn't correct
19 Incorrect 406 ms 13856 KB Output isn't correct
20 Correct 288 ms 10512 KB Output is correct