Submission #898814

# Submission time Handle Problem Language Result Execution time Memory
898814 2024-01-05T06:54:50 Z hadi7 Job Scheduling (CEOI12_jobs) C++17
10 / 100
394 ms 24660 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 ;
    }
 
    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: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 37 ms 9840 KB Output isn't correct
2 Incorrect 36 ms 9820 KB Output isn't correct
3 Incorrect 36 ms 9860 KB Output isn't correct
4 Incorrect 35 ms 9808 KB Output isn't correct
5 Incorrect 35 ms 9808 KB Output isn't correct
6 Incorrect 38 ms 9816 KB Output isn't correct
7 Incorrect 35 ms 9808 KB Output isn't correct
8 Incorrect 39 ms 9928 KB Output isn't correct
9 Incorrect 136 ms 9916 KB Output isn't correct
10 Incorrect 137 ms 10072 KB Output isn't correct
11 Incorrect 33 ms 9812 KB Output isn't correct
12 Correct 65 ms 11852 KB Output is correct
13 Incorrect 93 ms 13532 KB Output isn't correct
14 Correct 151 ms 15700 KB Output is correct
15 Incorrect 151 ms 17232 KB Output isn't correct
16 Incorrect 214 ms 19456 KB Output isn't correct
17 Incorrect 248 ms 21364 KB Output isn't correct
18 Incorrect 253 ms 22528 KB Output isn't correct
19 Incorrect 394 ms 24660 KB Output isn't correct
20 Incorrect 245 ms 21296 KB Output isn't correct