답안 #938067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
938067 2024-03-04T19:10:49 Z TAhmed33 Job Scheduling (CEOI12_jobs) C++
0 / 100
15 ms 1612 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 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;
}
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';
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1112 KB Output isn't correct
2 Incorrect 6 ms 1152 KB Output isn't correct
3 Incorrect 6 ms 1112 KB Output isn't correct
4 Incorrect 6 ms 1116 KB Output isn't correct
5 Incorrect 6 ms 984 KB Output isn't correct
6 Incorrect 6 ms 1112 KB Output isn't correct
7 Incorrect 6 ms 1116 KB Output isn't correct
8 Incorrect 6 ms 1116 KB Output isn't correct
9 Incorrect 15 ms 1108 KB Unexpected end of file - int32 expected
10 Incorrect 15 ms 856 KB Unexpected end of file - int32 expected
11 Incorrect 10 ms 1108 KB Output isn't correct
12 Incorrect 5 ms 1368 KB Output isn't correct
13 Incorrect 5 ms 1368 KB Output isn't correct
14 Incorrect 6 ms 1368 KB Output isn't correct
15 Incorrect 5 ms 1468 KB Output isn't correct
16 Incorrect 7 ms 1372 KB Output isn't correct
17 Incorrect 6 ms 1372 KB Output isn't correct
18 Incorrect 6 ms 1372 KB Output isn't correct
19 Incorrect 9 ms 1612 KB Output isn't correct
20 Incorrect 6 ms 1372 KB Output isn't correct