답안 #934430

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934430 2024-02-27T10:12:21 Z tamir1 Job Scheduling (CEOI12_jobs) C++14
55 / 100
194 ms 21328 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(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++){
			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);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 3164 KB Output isn't correct
2 Incorrect 15 ms 3420 KB Output isn't correct
3 Incorrect 13 ms 3160 KB Output isn't correct
4 Incorrect 13 ms 3164 KB Output isn't correct
5 Incorrect 14 ms 3068 KB Output isn't correct
6 Incorrect 13 ms 3164 KB Output isn't correct
7 Incorrect 13 ms 3164 KB Output isn't correct
8 Incorrect 13 ms 3164 KB Output isn't correct
9 Correct 24 ms 3460 KB Output is correct
10 Correct 24 ms 3412 KB Output is correct
11 Correct 20 ms 3164 KB Output is correct
12 Correct 40 ms 6008 KB Output is correct
13 Correct 61 ms 8532 KB Output is correct
14 Correct 86 ms 9296 KB Output is correct
15 Incorrect 104 ms 12116 KB Output isn't correct
16 Correct 129 ms 14972 KB Output is correct
17 Correct 149 ms 17748 KB Output is correct
18 Correct 168 ms 20504 KB Output is correct
19 Correct 194 ms 21328 KB Output is correct
20 Correct 150 ms 17748 KB Output is correct