Submission #1104696

# Submission time Handle Problem Language Result Execution time Memory
1104696 2024-10-24T09:00:34 Z Muhammet Job Scheduling (CEOI12_jobs) C++17
0 / 100
265 ms 17344 KB
#include <bits/stdc++.h>

using namespace std;

#define ff first
#define ss second

const int N = 2e5 + 5;

int T, n, m, d;

vector <pair<int,int>> a;

bool check(int x){
	int ind = -1, day = 0;
	while(ind < m-1){
		day++;
		for(int i = ind+1; i <= ind+x; i++){
			if(a[i].ss + d < day){
				return false;
			}
		}
		ind += x;
	}
	if(day > n) return false;
	return true;
}

int main(){
	cin >> n >> d >> m;
	a.resize(m);
	for(int i = 0; i < m; i++){
		cin >> a[i].ff;
		a[i].ss = i+1;
	}
	sort(a.begin(), a.end());
	int l = 1, r = m, k = m;
	while(l <= r){
		int md = (l + r) / 2;
		if(check(md)){
			r = md-1;
			k = md;
		}
		else {
			l = md+1;
		}
	}
	cout << k << '\n';
	int ind = -1, cnt = 0;
	while(ind < m-1){
		cnt++;
		for(int i = ind+1; i <= ind+k; i++){
			cout << a[i].ss << " ";
		}
		ind += k;
		cout << "0\n";
	}
	for(int i = cnt+1; i <= n; i++){
		cout << "0\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2128 KB Output isn't correct
2 Incorrect 22 ms 1936 KB Output isn't correct
3 Incorrect 25 ms 2024 KB Output isn't correct
4 Incorrect 23 ms 2012 KB Output isn't correct
5 Incorrect 23 ms 1920 KB Output isn't correct
6 Incorrect 22 ms 2128 KB Output isn't correct
7 Incorrect 22 ms 2296 KB Output isn't correct
8 Incorrect 22 ms 1976 KB Output isn't correct
9 Incorrect 29 ms 2128 KB Output isn't correct
10 Incorrect 30 ms 2228 KB Output isn't correct
11 Runtime error 24 ms 2360 KB Execution killed with signal 7
12 Runtime error 49 ms 4296 KB Execution killed with signal 7
13 Incorrect 85 ms 5708 KB Output isn't correct
14 Runtime error 105 ms 8776 KB Execution killed with signal 11
15 Incorrect 149 ms 9544 KB Output isn't correct
16 Runtime error 165 ms 12872 KB Execution killed with signal 11
17 Runtime error 180 ms 14848 KB Execution killed with signal 11
18 Incorrect 239 ms 15124 KB Output isn't correct
19 Incorrect 265 ms 17344 KB Output isn't correct
20 Runtime error 186 ms 14920 KB Execution killed with signal 11