Submission #734018

# Submission time Handle Problem Language Result Execution time Memory
734018 2023-05-01T13:42:47 Z AbodeKu Job Scheduling (CEOI12_jobs) C++17
0 / 100
212 ms 15296 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vpi;
typedef vector<vector<ll>> vvi;
const double EBS = 1e-9;

#define testCase ll t; cin >> t; while (t--)
#define fast  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(f, s, i) for (ll i = f; i < s; i++)
#define getunique(v) {sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());}
#define calunique(v)  disance(v.begin(),unique(v.begin(),v.end()));
#define popcount(i) __builtin_popcount(i)
#define el cout << "\n"
#define pb push_back
#define pf push_front
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define all(v) v.begin(), v.end()
#define PII pair<ll,ll>
#define INF (ll)1e9
#define INFLL (ll)1e18
#define debug cout << "___________________________________" << endl
#define int ll

int n , d , k ; 
vpi a ;

bool check(int num){
	int curr = 1 ; 
	
	rep(0 , k , i){
		while(curr < a[i].first) curr++;
		int cnt = 0 ;
		while( i < k && curr >= a[i].first && cnt < num){
			if (curr - a[i].first >= d) return 0 ;
			i++;
			cnt++;
		}
		if (curr - a[i].first > d) return 0 ;

		curr++;
	}
	return 1 ;
}

int32_t main(){
	fast ;
	cin >> n >> d >> k ; 
	a = vpi(k);
	rep(0 , k , i ) cin >> a[i].first , a[i].second = i+1 ;
	sort(all(a));
	int l = 0 , r = k + 1 ; 
	int ans = 0 ; 
	while(l + 1 < r ){
		int mid = (l + r) / 2 ; 
		if (check(mid)){
			ans = mid ; 
			r = mid ;
		}else{
			l = mid ;
		}
	}
	
	cout << ans + 1 << endl ;
	int idx = 0 ; 
	rep(0 , n , i){
		int cnt = 0 ;
		while(cnt <= ans && idx < k ) cout << a[idx++].second << " " ,  cnt++ ;
		cout << "0\n";
	}
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 2516 KB Output isn't correct
2 Incorrect 16 ms 2408 KB Output isn't correct
3 Incorrect 17 ms 2396 KB Output isn't correct
4 Incorrect 17 ms 2408 KB Output isn't correct
5 Incorrect 16 ms 2516 KB Output isn't correct
6 Incorrect 16 ms 2408 KB Output isn't correct
7 Incorrect 17 ms 2412 KB Output isn't correct
8 Incorrect 21 ms 2388 KB Output isn't correct
9 Incorrect 26 ms 2672 KB Output isn't correct
10 Incorrect 29 ms 2644 KB Output isn't correct
11 Incorrect 17 ms 1876 KB Output isn't correct
12 Incorrect 36 ms 3460 KB Output isn't correct
13 Incorrect 53 ms 5020 KB Output isn't correct
14 Incorrect 79 ms 6572 KB Output isn't correct
15 Incorrect 91 ms 8156 KB Output isn't correct
16 Incorrect 116 ms 9708 KB Output isn't correct
17 Incorrect 159 ms 11280 KB Output isn't correct
18 Incorrect 150 ms 12876 KB Output isn't correct
19 Incorrect 212 ms 15296 KB Output isn't correct
20 Incorrect 138 ms 11284 KB Output isn't correct