Submission #66278

# Submission time Handle Problem Language Result Execution time Memory
66278 2018-08-10T07:20:59 Z ikura355 Job Scheduling (CEOI12_jobs) C++14
15 / 100
276 ms 33792 KB
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define X first
#define Y second

const int maxn = 1e6 + 5;

int n,d,m;
pii a[maxn];
vector<int> work[maxn];

bool check(int num) {
	for(int day=0;day<n;day++) {
		for(int i=day*num;i<min(m,(day+1)*num);i++) {
			if(a[i].X+d<day+1) return 0;
		}
	}
	return 1;
}

int main() {
	scanf("%d%d%d",&n,&d,&m);
	for(int i=0;i<m;i++) scanf("%d",&a[i].X), a[i].Y = i+1;
	sort(&a[0],&a[m]);
	int l = 1, r = m/n + 1, mid, res = -1;
	while(l<=r) {
		mid = (l+r)/2;
		if(check(mid)) {
			res = mid;
			r = mid-1;
		}
		else l = mid+1;
	}
//	for(int day=0;day<n;day++) {
//		for(int i=day*res;i<min(m,(day+1)*res);i++) {
//			work[day].push_back(a[i].Y);
//		}
//	}
	printf("%d\n",res);
	for(int i=0;i<n;i++) {
//		for(auto t : work[i]) printf("%d ",t);
		printf("0\n");
	}
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&n,&d,&m);
  ~~~~~^~~~~~~~~~~~~~~~~~~
jobs.cpp:25:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<m;i++) scanf("%d",&a[i].X), a[i].Y = i+1;
                       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 24824 KB Output isn't correct
2 Incorrect 36 ms 25244 KB Output isn't correct
3 Incorrect 38 ms 25576 KB Output isn't correct
4 Incorrect 37 ms 26104 KB Output isn't correct
5 Incorrect 40 ms 26416 KB Output isn't correct
6 Incorrect 38 ms 26600 KB Output isn't correct
7 Incorrect 36 ms 27024 KB Output isn't correct
8 Incorrect 37 ms 27300 KB Output isn't correct
9 Incorrect 50 ms 27728 KB Output isn't correct
10 Incorrect 53 ms 27976 KB Output isn't correct
11 Correct 48 ms 28228 KB Output is correct
12 Correct 73 ms 29820 KB Output is correct
13 Correct 102 ms 31676 KB Output is correct
14 Runtime error 148 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
15 Runtime error 171 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
16 Runtime error 201 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
17 Runtime error 228 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
18 Runtime error 235 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
19 Runtime error 276 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
20 Runtime error 253 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.