Submission #453184

# Submission time Handle Problem Language Result Execution time Memory
453184 2021-08-04T08:39:15 Z osmanallazov Job Scheduling (CEOI12_jobs) C++14
55 / 100
624 ms 13800 KB
#include <bits/stdc++.h>
using namespace std;
#define MAXX 1000005
#define ll long long
pair<int,int>j[MAXX];
int n,m,d;
bool check(ll num) {
    if(num*n<m)return 0;
	for(ll k=0;k<n;k++) {
		for(ll i=k*num;i<min((ll)m,(k+1)*num);i++) {
			if(j[i].first+d<k+1) return 0;
		}
	}
	return 1;
}
int main(){
    cin>>n>>d>>m;
    for(int i=0;i<m;i++){
        cin>>j[i].first;
        j[i].second=i+1;
    }
    sort(j,j+m);
    int r=m,l=0,mid,res=-1;
    while(l<=r) {
		mid=(l+r)/2;
		if(check(mid)) {
			res=mid;
			r=mid-1;
		}
		else l=mid+1;
	}
	cout<<res<<endl;
	for(ll k=0;k<n;k++){
        for(ll i=k*res;i<min((ll)m,(k+1)*res);i++){
            cout<<j[i].second<<" ";
        }
        cout<<0<<endl;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 1572 KB Output isn't correct
2 Incorrect 53 ms 1640 KB Output isn't correct
3 Incorrect 61 ms 1668 KB Output isn't correct
4 Incorrect 52 ms 1604 KB Output isn't correct
5 Incorrect 57 ms 1604 KB Output isn't correct
6 Incorrect 53 ms 1632 KB Output isn't correct
7 Incorrect 53 ms 1656 KB Output isn't correct
8 Incorrect 52 ms 1672 KB Output isn't correct
9 Correct 231 ms 1832 KB Output is correct
10 Correct 237 ms 1784 KB Output is correct
11 Correct 66 ms 1568 KB Output is correct
12 Correct 102 ms 3080 KB Output is correct
13 Correct 148 ms 4612 KB Output is correct
14 Correct 301 ms 6016 KB Output is correct
15 Incorrect 252 ms 7492 KB Output isn't correct
16 Correct 339 ms 9024 KB Output is correct
17 Correct 506 ms 10560 KB Output is correct
18 Correct 436 ms 12052 KB Output is correct
19 Correct 624 ms 13800 KB Output is correct
20 Correct 394 ms 10568 KB Output is correct