Submission #898411

#TimeUsernameProblemLanguageResultExecution timeMemory
898411hadi7Job Scheduling (CEOI12_jobs)C++17
0 / 100
382 ms24652 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...