Submission #892714

# Submission time Handle Problem Language Result Execution time Memory
892714 2023-12-25T17:55:58 Z bashNewbie Job Scheduling (CEOI12_jobs) C++17
0 / 100
225 ms 32024 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define fast_io ios::sync_with_stdio(0), cin.tie(0)
#define pb push_back
template <typename T> using vt = vector<T>;
using vi = vt<int>;
using vvi = vt<vi>;

int main() {
	fast_io;

	int n, d, m; cin >> n >> d >> m;
	vi cnt(n), job(m); vvi in(n);
	for(int j = 0; j < m; j++) {
		int x; cin >> x, --x;
		cnt[x]++, job[j] = x, in[x].pb(j);
	}
	vi ord;
	for(int i = 0; i < n; i++) for(int x: in[i]) ord.pb(x);

	vvi day;
	auto proc = [&] (int N) {
		day = vvi(n+d);
		int cur = 0, l = 0;
		while(l < m) {
			int f = N;
			while(l < m && f > 0) {
				int on = job[ord[l]];
				if(on < cur-d) return 0;
				day[cur].pb(ord[l]), ++l, --f;
			}
			++cur;
		}
		return 1;
	};

	int x = 0, y = m, z;
	while(x < y) {
		z = x+y >> 1;
		if(proc(z)) y = z; else
		x = z+1;
	}
	proc(x);

	cout << x << "\n";
	for(int i = 0; i < n+d; i++) {
		for(int x: day[i]) cout << x+1 << " ";
		cout << "0\n";
	}
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:42:8: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   42 |   z = x+y >> 1;
      |       ~^~
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 3804 KB Output isn't correct
2 Incorrect 18 ms 3988 KB Output isn't correct
3 Incorrect 29 ms 3616 KB Output isn't correct
4 Incorrect 20 ms 3796 KB Output isn't correct
5 Incorrect 18 ms 3968 KB Output isn't correct
6 Incorrect 20 ms 3600 KB Output isn't correct
7 Incorrect 30 ms 3756 KB Output isn't correct
8 Incorrect 21 ms 3964 KB Output isn't correct
9 Incorrect 41 ms 12324 KB Extra information in the output file
10 Incorrect 28 ms 13100 KB Extra information in the output file
11 Incorrect 21 ms 3180 KB Extra information in the output file
12 Incorrect 62 ms 6344 KB Extra information in the output file
13 Incorrect 62 ms 10112 KB Extra information in the output file
14 Incorrect 114 ms 14068 KB Extra information in the output file
15 Incorrect 142 ms 14384 KB Output isn't correct
16 Incorrect 142 ms 19164 KB Extra information in the output file
17 Incorrect 225 ms 24744 KB Extra information in the output file
18 Incorrect 174 ms 25568 KB Extra information in the output file
19 Incorrect 210 ms 32024 KB Extra information in the output file
20 Incorrect 187 ms 24812 KB Extra information in the output file