Submission #898411

# Submission time Handle Problem Language Result Execution time Memory
898411 2024-01-04T15:59:48 Z hadi7 Job Scheduling (CEOI12_jobs) C++17
0 / 100
382 ms 24652 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 ;

main()
{
    int n , k , m ;
    cin >> n >> k >> m ;

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

    sort(p.begin() , p.end()) ;
    int mx = *max_element(mp.begin() , mp.end()) ;

    int l = 0 , r = 1e18 ;
    while(l + 1 < r)
    {
        int h = l + (r - l) / 2 ;
        if(ceil(mx / h) <= k && ceil(m / h) <= n)
            r = h ;
        else
            l = h ;
    }

    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:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main()
      | ^~~~
jobs.cpp: In function 'int main()':
jobs.cpp:26:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   26 |     int l = 0 , r = 1e18 ;
      |                     ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 9812 KB Expected EOLN
2 Incorrect 35 ms 9948 KB Expected EOLN
3 Incorrect 36 ms 9816 KB Expected EOLN
4 Incorrect 41 ms 9816 KB Expected EOLN
5 Incorrect 38 ms 9808 KB Expected EOLN
6 Incorrect 35 ms 9864 KB Expected EOLN
7 Incorrect 35 ms 9812 KB Expected EOLN
8 Incorrect 36 ms 9944 KB Expected EOLN
9 Incorrect 138 ms 10064 KB Expected EOLN
10 Incorrect 144 ms 9972 KB Expected EOLN
11 Incorrect 33 ms 9812 KB Expected EOLN
12 Incorrect 64 ms 11840 KB Expected EOLN
13 Incorrect 92 ms 13648 KB Expected EOLN
14 Incorrect 146 ms 15696 KB Expected EOLN
15 Incorrect 152 ms 17232 KB Expected EOLN
16 Incorrect 210 ms 19536 KB Expected EOLN
17 Incorrect 283 ms 21588 KB Expected EOLN
18 Incorrect 255 ms 22608 KB Expected EOLN
19 Incorrect 382 ms 24652 KB Expected EOLN
20 Incorrect 242 ms 21464 KB Expected EOLN