Submission #858443

# Submission time Handle Problem Language Result Execution time Memory
858443 2023-10-08T13:44:17 Z ilef Job Scheduling (CEOI12_jobs) C++14
5 / 100
152 ms 4688 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 day<=n;
}

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;
	int days=1;
	for(int i=0;i<m;i++){
	    if(a[i].first<=days){
	     cout<<a[i].second+1<<" ";
	     cnt++;
	      if(cnt==r){
	        cout<<0<<endl;
	        cnt=0;
	        days++;}}
	         else{
	        cout<<0<<endl;
	         days++;
	        cnt=0;
	         }
	    
	}
	for(int i=days+1;i<=n;i++){
	    cout<<0<<endl;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 3164 KB Unexpected end of file - int32 expected
2 Incorrect 32 ms 3256 KB Unexpected end of file - int32 expected
3 Incorrect 32 ms 3164 KB Unexpected end of file - int32 expected
4 Incorrect 33 ms 3132 KB Unexpected end of file - int32 expected
5 Incorrect 37 ms 3164 KB Unexpected end of file - int32 expected
6 Incorrect 32 ms 3416 KB Unexpected end of file - int32 expected
7 Incorrect 32 ms 3156 KB Unexpected end of file - int32 expected
8 Incorrect 33 ms 3156 KB Unexpected end of file - int32 expected
9 Incorrect 139 ms 3412 KB Unexpected end of file - int32 expected
10 Incorrect 136 ms 3408 KB Unexpected end of file - int32 expected
11 Incorrect 31 ms 3156 KB Unexpected end of file - int32 expected
12 Correct 62 ms 3924 KB Output is correct
13 Incorrect 93 ms 4688 KB Unexpected end of file - int32 expected
14 Incorrect 63 ms 2648 KB Output isn't correct
15 Incorrect 53 ms 2648 KB Output isn't correct
16 Incorrect 62 ms 2648 KB Output isn't correct
17 Incorrect 63 ms 2648 KB Output isn't correct
18 Incorrect 54 ms 3024 KB Output isn't correct
19 Incorrect 152 ms 2900 KB Output isn't correct
20 Incorrect 62 ms 2652 KB Output isn't correct