답안 #66276

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
66276 2018-08-10T07:18:21 Z ikura355 Job Scheduling (CEOI12_jobs) C++14
0 / 100
841 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, 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;
                       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 24824 KB Output isn't correct
2 Incorrect 42 ms 25292 KB Output isn't correct
3 Incorrect 43 ms 25692 KB Output isn't correct
4 Incorrect 40 ms 25956 KB Output isn't correct
5 Incorrect 40 ms 26316 KB Output isn't correct
6 Incorrect 41 ms 26740 KB Output isn't correct
7 Incorrect 55 ms 26944 KB Output isn't correct
8 Incorrect 58 ms 27240 KB Output isn't correct
9 Runtime error 216 ms 33792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 203 ms 33792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 78 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.
12 Runtime error 72 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.
13 Runtime error 100 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.
14 Runtime error 139 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 156 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 416 ms 33792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 649 ms 33792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 732 ms 33792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 841 ms 33792 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 674 ms 33792 KB Execution killed with signal 11 (could be triggered by violating memory limits)