Submission #934436

# Submission time Handle Problem Language Result Execution time Memory
934436 2024-02-27T10:20:08 Z tamir1 Job Scheduling (CEOI12_jobs) C++14
0 / 100
149 ms 14928 KB
#include<bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
using namespace std;
ll i,n,d,m,l,r,mid,ans;
pair<ll,ll> a[1000005];
bool check(ll mid){
	ll i,j,day=0;
	i=1;
	while(i<=m){
		day++;
		for(j=i;j<i+mid && j<=m;j++){
			if(a[j].ff>day) break;
			if(day>a[j].ff+d) return 0;
		}
		i=j;
	}
	return 1;
}
void solve(ll x){
	ll i,j,day=0;
	i=1;
	while(i<=m){
		day++;
		for(j=i;j<i+x && j<=m;j++){
			if(a[j].ff>day) break;
			cout << a[j].ss << " ";
		}
		i=j;
		cout << 0 << "\n";
	}
	for(i=day+1;i<=n;i++){
		cout << 0 << "\n";
	}
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> d >> m;
	for(i=1;i<=m;i++){
		cin >> a[i].ff;
		a[i].ss=i;
	}
	sort(a+1,a+m+1);
	l=1;
	r=m;
	while(r-l>1){
		mid=(r+l+1)/2;
		if(check(mid)) r=mid;
		else l=mid;
	}
	if(check(l)) ans=l;
	else if(check(r)) ans=r;
	cout << ans << "\n";
	//solve(ans);
}
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 2648 KB Unexpected end of file - int32 expected
2 Incorrect 7 ms 2652 KB Unexpected end of file - int32 expected
3 Incorrect 8 ms 2652 KB Unexpected end of file - int32 expected
4 Incorrect 8 ms 2652 KB Unexpected end of file - int32 expected
5 Incorrect 8 ms 2692 KB Unexpected end of file - int32 expected
6 Incorrect 8 ms 2908 KB Unexpected end of file - int32 expected
7 Incorrect 8 ms 2652 KB Unexpected end of file - int32 expected
8 Incorrect 8 ms 2652 KB Unexpected end of file - int32 expected
9 Incorrect 15 ms 2652 KB Unexpected end of file - int32 expected
10 Incorrect 14 ms 2652 KB Unexpected end of file - int32 expected
11 Incorrect 15 ms 2648 KB Unexpected end of file - int32 expected
12 Incorrect 30 ms 4700 KB Unexpected end of file - int32 expected
13 Incorrect 46 ms 6748 KB Unexpected end of file - int32 expected
14 Incorrect 68 ms 6772 KB Unexpected end of file - int32 expected
15 Incorrect 78 ms 8796 KB Unexpected end of file - int32 expected
16 Incorrect 97 ms 10836 KB Unexpected end of file - int32 expected
17 Incorrect 114 ms 12880 KB Unexpected end of file - int32 expected
18 Incorrect 126 ms 14928 KB Unexpected end of file - int32 expected
19 Incorrect 149 ms 14928 KB Unexpected end of file - int32 expected
20 Incorrect 113 ms 12884 KB Unexpected end of file - int32 expected