# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
791519 | 2023-07-24T07:09:12 Z | I_FloPPed21 | Job Scheduling (CEOI12_jobs) | C++14 | 250 ms | 14300 KB |
#include <bits/stdc++.h> using namespace std; long long n, d, m ; struct neveu { int a, b ; } v [ 1000005 ]; bool check(long long caz ) { int ziua = 1 ; for ( int i = 1; i <= m ; i += caz, ziua ++ ) { if ( v[ i ].a < ziua ) return false ; if ( ziua > n ) return false ; } return true ; } bool compare ( neveu x, neveu y) { return ( x. a < y . a ); } int main() { cin >> n >> d >> m ; for ( int i = 1; i <= m ; i ++ ) { cin >> v[ i ].a ; v [ i ].a += d ; v [ i] . b = i ; } sort ( v + 1, v + m + 1, compare) ; long long poz = 1e9 ; int st = 1, dr = m ; while ( st <= dr ) { long long mij = ( st + dr ) / 2 ; if ( check ( mij ) == true ) { poz = mij ; dr = mij - 1; } else st = mij + 1; } cout << poz << '\n' ; long long masini = poz ; long long ziua = 1 ; for ( int i = 1; i <= m ; i ++ ) { cout << v [ i ].b << " "; masini -- ; if ( masini == 0 ) { cout << 0 << '\n'; masini = poz ; ziua ++ ; } } while ( ziua <= n ) { cout << 0 << '\n'; ziua ++ ; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 1712 KB | Output isn't correct |
2 | Incorrect | 23 ms | 1684 KB | Output isn't correct |
3 | Incorrect | 22 ms | 1740 KB | Output isn't correct |
4 | Incorrect | 22 ms | 1700 KB | Output isn't correct |
5 | Incorrect | 22 ms | 1748 KB | Output isn't correct |
6 | Incorrect | 29 ms | 1704 KB | Output isn't correct |
7 | Incorrect | 23 ms | 1756 KB | Output isn't correct |
8 | Incorrect | 22 ms | 1740 KB | Output isn't correct |
9 | Correct | 34 ms | 2024 KB | Output is correct |
10 | Correct | 33 ms | 2016 KB | Output is correct |
11 | Correct | 27 ms | 1616 KB | Output is correct |
12 | Correct | 55 ms | 3192 KB | Output is correct |
13 | Correct | 80 ms | 4608 KB | Output is correct |
14 | Correct | 123 ms | 6268 KB | Output is correct |
15 | Incorrect | 142 ms | 7576 KB | Output isn't correct |
16 | Correct | 188 ms | 9320 KB | Output is correct |
17 | Correct | 216 ms | 10732 KB | Output is correct |
18 | Correct | 215 ms | 12160 KB | Output is correct |
19 | Correct | 250 ms | 14300 KB | Output is correct |
20 | Correct | 227 ms | 10832 KB | Output is correct |