답안 #938068

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
938068 2024-03-04T19:11:59 Z TAhmed33 Job Scheduling (CEOI12_jobs) C++
10 / 100
195 ms 3976 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 25;
int n, d, m;
int a[MAXN];
bool check (int x) {
	bool flag = 1;
	int c = 0;
	for (int i = 1; i <= n; i++) {
		if (i % x == 1) c++;
		flag &= c <= a[i] + d;
	}
	return flag;
}
void cringe () {
	for (int i = 1; i <= n; i++) cout << 0 << endl;
}
int main () {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> d >> m;
	for (int i = 1; i <= m; i++) cin >> a[i];
	sort(a + 1, a + m + 1);
	int l = 2, r = m, ans = 1;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (check(mid)) {
			r = mid - 1; ans = mid;
		} else {
			l = mid + 1;
		}
	}
	cout << ans << '\n';
	cringe();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 2652 KB Output isn't correct
2 Incorrect 17 ms 2652 KB Output isn't correct
3 Incorrect 17 ms 2652 KB Output isn't correct
4 Incorrect 17 ms 2652 KB Output isn't correct
5 Incorrect 17 ms 2652 KB Output isn't correct
6 Incorrect 18 ms 2648 KB Output isn't correct
7 Incorrect 17 ms 2652 KB Output isn't correct
8 Incorrect 17 ms 2652 KB Output isn't correct
9 Correct 122 ms 2764 KB Output is correct
10 Correct 123 ms 2772 KB Output is correct
11 Incorrect 10 ms 2648 KB Output isn't correct
12 Incorrect 21 ms 2652 KB Output isn't correct
13 Incorrect 29 ms 2652 KB Output isn't correct
14 Incorrect 55 ms 2648 KB Output isn't correct
15 Incorrect 46 ms 2648 KB Output isn't correct
16 Incorrect 74 ms 2788 KB Output isn't correct
17 Incorrect 84 ms 3176 KB Output isn't correct
18 Incorrect 93 ms 3572 KB Output isn't correct
19 Incorrect 195 ms 3976 KB Output isn't correct
20 Incorrect 97 ms 3184 KB Output isn't correct