답안 #113329

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113329 2019-05-25T05:32:43 Z Kastanda Job Scheduling (CEOI12_jobs) C++11
0 / 100
257 ms 20216 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, d, q, qu[N * 10];
vector < int > A[N];
inline bool Solve(int md, bool fnl = 0)
{
	if (fnl)
		printf("%d\n", md);
	int l = 0, r = 0;
	for (int i = 1; i <= n; i++)
	{
		if (r - l && qu[l] < i - d)
			return 0;
		for (int id : A[i])
			qu[r ++] = id;
		for (int j = 0; j < md && l < r; j++)
		{
			if (fnl)
				printf("%d ", qu[l]);
			l ++;
		}
		if (fnl)
			printf("0\n");
	}
	return 1;
}
int main()
{
	scanf("%d%d%d", &n, &d, &q);
	for (int i = 1, a; i <= q; i++)
		scanf("%d", &a), A[a].push_back(i);
	int le = -1, ri = q, md;
	while (ri - le > 1)
	{
		md = (le + ri) >> 1;
		if (Solve(md))
			ri = md;
		else
			le = md;
	}
	Solve(ri, 1);
	return 0;
}

Compilation message

jobs.cpp: In function 'int main()':
jobs.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &n, &d, &q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
jobs.cpp:32:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a), A[a].push_back(i);
   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 4472 KB Output isn't correct
2 Incorrect 22 ms 4464 KB Output isn't correct
3 Incorrect 23 ms 4592 KB Output isn't correct
4 Incorrect 22 ms 4592 KB Output isn't correct
5 Incorrect 23 ms 4472 KB Output isn't correct
6 Incorrect 22 ms 4472 KB Output isn't correct
7 Incorrect 22 ms 4464 KB Output isn't correct
8 Incorrect 23 ms 4472 KB Output isn't correct
9 Incorrect 28 ms 4676 KB Output isn't correct
10 Incorrect 28 ms 4736 KB Output isn't correct
11 Incorrect 27 ms 4644 KB Output isn't correct
12 Incorrect 49 ms 6520 KB Output isn't correct
13 Incorrect 70 ms 9080 KB Output isn't correct
14 Incorrect 118 ms 11384 KB Output isn't correct
15 Incorrect 77 ms 10104 KB Output isn't correct
16 Incorrect 177 ms 15992 KB Output isn't correct
17 Incorrect 209 ms 18668 KB Output isn't correct
18 Incorrect 178 ms 18680 KB Output isn't correct
19 Incorrect 224 ms 20216 KB Output isn't correct
20 Incorrect 257 ms 18680 KB Output isn't correct