Submission #898413

# Submission time Handle Problem Language Result Execution time Memory
898413 2024-01-04T16:03:35 Z hadi7 Job Scheduling (CEOI12_jobs) C++17
0 / 100
393 ms 21916 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((double)mx / h) <= k && ceil((double)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 9556 KB Expected EOLN
2 Incorrect 35 ms 9572 KB Expected EOLN
3 Incorrect 37 ms 9564 KB Expected EOLN
4 Incorrect 44 ms 9548 KB Expected EOLN
5 Incorrect 49 ms 9572 KB Expected EOLN
6 Incorrect 35 ms 9564 KB Expected EOLN
7 Incorrect 42 ms 9552 KB Expected EOLN
8 Incorrect 35 ms 9564 KB Expected EOLN
9 Incorrect 137 ms 9668 KB Expected EOLN
10 Incorrect 139 ms 9812 KB Expected EOLN
11 Incorrect 35 ms 9552 KB Expected EOLN
12 Incorrect 63 ms 11088 KB Expected EOLN
13 Incorrect 114 ms 12372 KB Expected EOLN
14 Incorrect 144 ms 13944 KB Expected EOLN
15 Incorrect 155 ms 15656 KB Expected EOLN
16 Incorrect 222 ms 17084 KB Expected EOLN
17 Incorrect 245 ms 18512 KB Expected EOLN
18 Incorrect 261 ms 20048 KB Expected EOLN
19 Incorrect 393 ms 21916 KB Expected EOLN
20 Incorrect 241 ms 18392 KB Expected EOLN