Submission #858423

# Submission time Handle Problem Language Result Execution time Memory
858423 2023-10-08T13:22:41 Z ilef Job Scheduling (CEOI12_jobs) C++14
0 / 100
96 ms 4948 KB
#include <bits/stdc++.h>
using namespace std;
const int M=3e5+12;
int n,d,m;
 pair<int,int>a[M];
bool good(int num) {
     int i=0;
     int day=1;
     int cnt=0;
     while(i<m){
         if(cnt==num){
             cnt=0;
             day++;
         }
         if(a[i].first>day){
             day=a[i].first;
         }
         if(a[i].first+d<day){
             return false;
         }
         i++;
         cnt++;
     }
     return true;
}

int main() {
	cin>>n>>d>>m;
   
	for(int i=0;i<m;i++){
	    cin>>a[i].first;
	    a[i].second=i;
	}
	sort(a,a+m);
	int l=0;
	int r=m;
	while(l+1<r){
	    int mid=(l+r)/2;
	    if(good(mid)){
	        r=mid;
	    }
	    else{
	        l=mid;
	    }
	}
	int cnt=0;
	cout<<r<<endl;
	for(int i=0;i<m;i++){
	    if(cnt==r){
	        cout<<0<<endl;
	        cnt=0;
	    }
	    cout<<a[i].second+1<<" ";
	   
	    cnt++;
	}
	cout<<0<<endl;
	cout<<0<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 3164 KB Unexpected end of file - int32 expected
2 Incorrect 23 ms 3164 KB Unexpected end of file - int32 expected
3 Incorrect 24 ms 3404 KB Unexpected end of file - int32 expected
4 Incorrect 23 ms 3180 KB Unexpected end of file - int32 expected
5 Incorrect 24 ms 3160 KB Unexpected end of file - int32 expected
6 Incorrect 26 ms 3164 KB Unexpected end of file - int32 expected
7 Incorrect 23 ms 3124 KB Unexpected end of file - int32 expected
8 Incorrect 23 ms 3164 KB Unexpected end of file - int32 expected
9 Incorrect 29 ms 3156 KB Unexpected end of file - int32 expected
10 Incorrect 29 ms 3156 KB Unexpected end of file - int32 expected
11 Incorrect 33 ms 3172 KB Unexpected end of file - int32 expected
12 Incorrect 65 ms 3920 KB Extra information in the output file
13 Incorrect 96 ms 4948 KB Unexpected end of file - int32 expected
14 Incorrect 52 ms 2648 KB Output isn't correct
15 Incorrect 43 ms 2660 KB Output isn't correct
16 Incorrect 54 ms 2896 KB Output isn't correct
17 Incorrect 56 ms 2648 KB Output isn't correct
18 Incorrect 43 ms 2652 KB Output isn't correct
19 Incorrect 43 ms 2652 KB Output isn't correct
20 Incorrect 56 ms 2648 KB Output isn't correct