# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
898830 | 2024-01-05T07:20:47 Z | hadi7 | Job Scheduling (CEOI12_jobs) | C++17 | 391 ms | 13880 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(i > n) return 0 ; 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 = 1e18 ; 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 34 ms | 1628 KB | Output isn't correct |
2 | Incorrect | 37 ms | 1720 KB | Output isn't correct |
3 | Incorrect | 37 ms | 1628 KB | Output isn't correct |
4 | Incorrect | 36 ms | 1628 KB | Output isn't correct |
5 | Incorrect | 35 ms | 1628 KB | Output isn't correct |
6 | Incorrect | 35 ms | 1620 KB | Output isn't correct |
7 | Incorrect | 33 ms | 1752 KB | Output isn't correct |
8 | Incorrect | 36 ms | 1620 KB | Output isn't correct |
9 | Incorrect | 141 ms | 1880 KB | Output isn't correct |
10 | Incorrect | 139 ms | 1872 KB | Output isn't correct |
11 | Incorrect | 31 ms | 1800 KB | Output isn't correct |
12 | Incorrect | 64 ms | 3280 KB | Output isn't correct |
13 | Incorrect | 100 ms | 4560 KB | Output isn't correct |
14 | Incorrect | 150 ms | 6112 KB | Output isn't correct |
15 | Incorrect | 156 ms | 7508 KB | Output isn't correct |
16 | Incorrect | 211 ms | 9208 KB | Output isn't correct |
17 | Incorrect | 263 ms | 10508 KB | Output isn't correct |
18 | Incorrect | 258 ms | 12060 KB | Output isn't correct |
19 | Incorrect | 391 ms | 13880 KB | Output isn't correct |
20 | Incorrect | 246 ms | 10580 KB | Output isn't correct |