답안 #934411

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934411 2024-02-27T09:56:54 Z tamir1 Job Scheduling (CEOI12_jobs) C++14
0 / 100
144 ms 16828 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=1,j,day=0;
	while(i<=m){
		day++;
		for(j=i;j<i+mid && j<=m;j++){
			if(day>a[j].ff+d) return 0;
		}
		i=j;
	}
	if(day>n) return 0;
	return 1;
}
/*void solve(ll x){
	ll i,j,idx,day=0;
	for(i=1;i<=m;){
		day++;
		idx=0;
		for(j=i;j<i+x && j<=m;j++){
			if(a[j].ff<day) break;
			idx=max(idx,j);
		}
		i=idx+1;
		cout << 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 ans=r;
	cout << ans << "\n";
	//solve(ans);
} 
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 2904 KB Output isn't correct
2 Incorrect 8 ms 2908 KB Output isn't correct
3 Incorrect 8 ms 2908 KB Output isn't correct
4 Incorrect 8 ms 3000 KB Output isn't correct
5 Incorrect 11 ms 2988 KB Output isn't correct
6 Incorrect 8 ms 2908 KB Output isn't correct
7 Incorrect 9 ms 2908 KB Output isn't correct
8 Incorrect 8 ms 2908 KB Output isn't correct
9 Incorrect 15 ms 2908 KB Unexpected end of file - int32 expected
10 Incorrect 14 ms 2908 KB Unexpected end of file - int32 expected
11 Incorrect 15 ms 3076 KB Unexpected end of file - int32 expected
12 Incorrect 31 ms 5212 KB Unexpected end of file - int32 expected
13 Incorrect 46 ms 7516 KB Unexpected end of file - int32 expected
14 Incorrect 66 ms 8020 KB Unexpected end of file - int32 expected
15 Incorrect 80 ms 10152 KB Output isn't correct
16 Incorrect 96 ms 12676 KB Unexpected end of file - int32 expected
17 Incorrect 114 ms 14800 KB Unexpected end of file - int32 expected
18 Incorrect 133 ms 16664 KB Unexpected end of file - int32 expected
19 Incorrect 144 ms 16828 KB Unexpected end of file - int32 expected
20 Incorrect 116 ms 15112 KB Unexpected end of file - int32 expected