# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
831225 | 2023-08-20T00:32:52 Z | TimAni | Job Scheduling (CEOI12_jobs) | C++17 | 214 ms | 13772 KB |
#include <algorithm> #include <cassert> #include <cstdio> #include <iostream> #include <string> #include <vector> #include <set> #include <map> #include <numeric> #include <stack> #include <queue> #include <cmath> //#ifndef ONLINE_JUDGE //#include "/home/linux/Learning/headers/debug.h" //#else //#define debug(...) //#endif using namespace std; using ll = long long; void setIO(string File_name) { cin.tie(0)->sync_with_stdio(0); if (File_name.size()) { freopen((File_name + ".in").c_str(), "r", stdin); freopen((File_name + ".out").c_str(), "w", stdout); } } void sol() { int n, d, m; cin >> n >> d >> m; vector<pair<int, int>> v(m); for (int i = 0; i < m; i++) cin >> v[i].first, v[i].second = i + 1; sort(v.begin(), v.end()); auto good = [&](int mid) { for (int i = 0, day = 0, free = mid; i < m; day++, free = mid) { while (i < m && v[i].first <= day && free > 0) { if (day - v[i].first > d) return false; i++; free--; } } return true; }; int l = 0, r = m + 1; while (r > l) { int mid = l + (r - l) / 2; if (good(mid)) r = mid; else l = mid + 1; } cout << r << '\n'; int day = v[0].first; int free = r; for (int i = 0, j = 1; j <= n; j++) { while (i < m && v[i].first <= day && free > 0) { cout << v[i].second << ' '; i++; free--; } cout << "0 \n"; day++; free = r; } } int main() { setIO(""); int T = 1; //cin >> T; while (T--) sol(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 15 ms | 1672 KB | Expected EOLN |
2 | Incorrect | 14 ms | 1636 KB | Expected EOLN |
3 | Incorrect | 14 ms | 1624 KB | Expected EOLN |
4 | Incorrect | 17 ms | 1628 KB | Expected EOLN |
5 | Incorrect | 14 ms | 1624 KB | Expected EOLN |
6 | Incorrect | 15 ms | 1740 KB | Expected EOLN |
7 | Incorrect | 14 ms | 1676 KB | Expected EOLN |
8 | Incorrect | 14 ms | 1628 KB | Expected EOLN |
9 | Incorrect | 21 ms | 1988 KB | Expected EOLN |
10 | Incorrect | 21 ms | 1992 KB | Expected EOLN |
11 | Incorrect | 28 ms | 1628 KB | Expected EOLN |
12 | Incorrect | 41 ms | 3172 KB | Expected EOLN |
13 | Incorrect | 61 ms | 4592 KB | Expected EOLN |
14 | Incorrect | 87 ms | 6132 KB | Expected EOLN |
15 | Incorrect | 102 ms | 7628 KB | Expected EOLN |
16 | Incorrect | 136 ms | 9112 KB | Expected EOLN |
17 | Incorrect | 154 ms | 10600 KB | Expected EOLN |
18 | Incorrect | 168 ms | 12108 KB | Expected EOLN |
19 | Incorrect | 214 ms | 13772 KB | Expected EOLN |
20 | Incorrect | 157 ms | 10604 KB | Expected EOLN |