Submission #453175

# Submission time Handle Problem Language Result Execution time Memory
453175 2021-08-04T08:32:54 Z osmanallazov Job Scheduling (CEOI12_jobs) C++14
0 / 100
618 ms 13656 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=1;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 55 ms 1612 KB Output isn't correct
2 Incorrect 52 ms 1656 KB Output isn't correct
3 Incorrect 58 ms 1640 KB Output isn't correct
4 Incorrect 54 ms 1560 KB Output isn't correct
5 Incorrect 53 ms 1656 KB Output isn't correct
6 Incorrect 54 ms 1748 KB Output isn't correct
7 Incorrect 53 ms 1596 KB Output isn't correct
8 Incorrect 61 ms 1652 KB Output isn't correct
9 Incorrect 291 ms 1936 KB Unexpected end of file - int32 expected
10 Incorrect 210 ms 1808 KB Unexpected end of file - int32 expected
11 Incorrect 50 ms 1604 KB Unexpected end of file - int32 expected
12 Incorrect 99 ms 3108 KB Unexpected end of file - int32 expected
13 Incorrect 151 ms 4596 KB Unexpected end of file - int32 expected
14 Incorrect 240 ms 6092 KB Unexpected end of file - int32 expected
15 Incorrect 253 ms 7568 KB Output isn't correct
16 Incorrect 340 ms 9072 KB Unexpected end of file - int32 expected
17 Incorrect 451 ms 10544 KB Unexpected end of file - int32 expected
18 Incorrect 465 ms 11952 KB Unexpected end of file - int32 expected
19 Incorrect 618 ms 13656 KB Unexpected end of file - int32 expected
20 Incorrect 420 ms 10560 KB Unexpected end of file - int32 expected