Submission #978359

# Submission time Handle Problem Language Result Execution time Memory
978359 2024-05-09T07:01:57 Z batsukh2006 Job Scheduling (CEOI12_jobs) C++17
0 / 100
159 ms 14516 KB
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<map>
#include<string>
#include<algorithm>
#include<vector>
#include<string.h>
#include<utility>
#include<set>
#include<cmath>
#include<queue>
#include<deque>
#include<functional>
#include<stack>
#include<limits.h>
#include<iomanip>
#include<unordered_map> 
#include<numeric>
#include<tuple>
#include<bitset>
using namespace std;
#define MOD 1000000007
#define int long long
#define ss second
#define ff first
#define endl '\n'		
signed main(){
    // freopen("file.in", "r", stdin);
    // freopen("file.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int n,d,m; cin>>n>>d>>m;
    vector<int> a(m+1);
    for(int i=1; i<=m; i++) cin>>a[i];
    sort(a.begin(),a.end());
    int l=1,r=m;
    while(l<=r){
    	int mid=l+(r-l)/2;
    	bool ok=1;
    	for(int i=mid,j=1; i<=m; i+=min(mid,m-i),j++){
    		if(j>a[i]+d) ok=0;
    		if(i==m) break;
    	}
    	if(ok) r=mid-1;
    	else l=mid+1;
    }
    for(int i=1,j=1; i<=n; i++){
    	while(j<=m){
    		cout<<a[j]<<' ';
    		if(j++%l==0) break;
    	}
    	cout<<0<<endl;
    }
    return 0;
}



























# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 1628 KB Expected EOLN
2 Incorrect 11 ms 1628 KB Expected EOLN
3 Incorrect 12 ms 1628 KB Expected EOLN
4 Incorrect 13 ms 1628 KB Expected EOLN
5 Incorrect 11 ms 1624 KB Expected EOLN
6 Incorrect 11 ms 1628 KB Expected EOLN
7 Incorrect 17 ms 1628 KB Expected EOLN
8 Incorrect 11 ms 1628 KB Expected EOLN
9 Incorrect 18 ms 1884 KB Expected EOLN
10 Incorrect 17 ms 1872 KB Expected EOLN
11 Incorrect 15 ms 1884 KB Expected EOLN
12 Incorrect 30 ms 3416 KB Expected EOLN
13 Incorrect 43 ms 4968 KB Expected EOLN
14 Incorrect 66 ms 7508 KB Expected EOLN
15 Incorrect 73 ms 8016 KB Expected EOLN
16 Incorrect 115 ms 10836 KB Expected EOLN
17 Incorrect 113 ms 12580 KB Expected EOLN
18 Incorrect 115 ms 12688 KB Expected EOLN
19 Incorrect 159 ms 14516 KB Expected EOLN
20 Incorrect 114 ms 12696 KB Expected EOLN