Submission #744285

# Submission time Handle Problem Language Result Execution time Memory
744285 2023-05-18T10:22:58 Z MODDI Job Scheduling (CEOI12_jobs) C++14
0 / 100
283 ms 7328 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int,int> pii;
typedef vector<long long> vl;
typedef vector<int> vi;
int n, d, m;
vector<pii> arr;
bool check(int machines){
	int job = m-1;
	for(int day = n; day >= 1; day--){
		int cnt = 0;
		while(arr[job].first - day <= d && cnt + 1 <= machines){
			job--;
			cnt++;
		}
		if(job < 0)	return true;
	}
	return false;
}
int main(){
	cin>>n>>d>>m;
	arr.resize(m);
	for(int i = 0; i < m; i++)
	{
		cin>>arr[i].first;
		arr[i].second = i;
	}
	sort(arr.begin(), arr.end());
	int l = 1, r = 1e6+10, ans = -1;
	while(l <= r){
		int mid = (l + r) / 2;
		bool can = check(mid);
		if(can){
			ans = mid;
			r = mid - 1;
		}
		else
			l = mid + 1;
	}
	cout<<ans<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1108 KB Output isn't correct
2 Incorrect 24 ms 1088 KB Output isn't correct
3 Incorrect 22 ms 1092 KB Output isn't correct
4 Incorrect 21 ms 980 KB Output isn't correct
5 Incorrect 24 ms 980 KB Output isn't correct
6 Incorrect 20 ms 980 KB Output isn't correct
7 Incorrect 20 ms 980 KB Output isn't correct
8 Incorrect 21 ms 1096 KB Output isn't correct
9 Incorrect 26 ms 1092 KB Output isn't correct
10 Incorrect 29 ms 1080 KB Output isn't correct
11 Incorrect 31 ms 980 KB Output isn't correct
12 Incorrect 75 ms 1856 KB Unexpected end of file - int32 expected
13 Incorrect 110 ms 2644 KB Output isn't correct
14 Incorrect 133 ms 3416 KB Unexpected end of file - int32 expected
15 Incorrect 150 ms 4208 KB Output isn't correct
16 Incorrect 198 ms 4948 KB Output isn't correct
17 Incorrect 266 ms 5772 KB Output isn't correct
18 Incorrect 258 ms 6552 KB Output isn't correct
19 Incorrect 283 ms 7328 KB Output isn't correct
20 Incorrect 235 ms 5836 KB Output isn't correct