# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
104866 | 2019-04-09T11:57:31 Z | daili | Job Scheduling (CEOI12_jobs) | C++14 | 530 ms | 8676 KB |
#include <bits/stdc++.h> using namespace std; bool check(vector<pair<int,int>> &allJobs, int currNr, int delay, int days) { vector<int> used(days+1); for (int i = 0; i < allJobs.size(); i++) { int currentDay = allJobs[i].first; while(used[currentDay] >= currNr) { currentDay++; } if (currentDay > allJobs[i].first + delay) { return false; } used[currentDay]++; } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, d, m; cin >> n >> d >> m; vector<pair<int,int>> allJobs; for (int i = 0; i < m; i++) { int x; cin >> x; allJobs.push_back({x, i+1}); } sort(allJobs.begin(), allJobs.end()); int left = 0; int right = m; while(left < right) { int mid = (left + right) >> 1; if (check(allJobs, mid, d, n)) { right = mid; } else { left = mid + 1; } } int mid = (left+right) >> 1; cout << mid << "\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 20 ms | 1532 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 17 ms | 1532 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 20 ms | 1532 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 17 ms | 1532 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 23 ms | 1532 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 19 ms | 1532 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 19 ms | 1532 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 17 ms | 1532 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 25 ms | 1532 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 26 ms | 1532 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 34 ms | 1532 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 93 ms | 2552 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 74 ms | 4584 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 530 ms | 4516 KB | Unexpected end of file - int32 expected |
15 | Incorrect | 180 ms | 4588 KB | Unexpected end of file - int32 expected |
16 | Incorrect | 168 ms | 8672 KB | Unexpected end of file - int32 expected |
17 | Incorrect | 240 ms | 8672 KB | Unexpected end of file - int32 expected |
18 | Incorrect | 219 ms | 8676 KB | Unexpected end of file - int32 expected |
19 | Incorrect | 281 ms | 8672 KB | Unexpected end of file - int32 expected |
20 | Incorrect | 232 ms | 8676 KB | Unexpected end of file - int32 expected |