답안 #113334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113334 2019-05-25T06:08:32 Z Kastanda Job Scheduling (CEOI12_jobs) C++11
5 / 100
231 ms 16760 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");
	}
	if (r - l)
		return 0;
	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 = 0, 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:32: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:34: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 23 ms 4216 KB Output isn't correct
2 Incorrect 23 ms 4208 KB Output isn't correct
3 Incorrect 29 ms 4372 KB Output isn't correct
4 Incorrect 24 ms 4208 KB Output isn't correct
5 Incorrect 24 ms 4180 KB Output isn't correct
6 Incorrect 22 ms 4188 KB Output isn't correct
7 Incorrect 25 ms 4208 KB Output isn't correct
8 Incorrect 22 ms 4216 KB Output isn't correct
9 Incorrect 27 ms 4480 KB Output isn't correct
10 Incorrect 27 ms 4480 KB Output isn't correct
11 Incorrect 25 ms 4220 KB Output isn't correct
12 Incorrect 46 ms 5752 KB Output isn't correct
13 Incorrect 69 ms 8028 KB Output isn't correct
14 Incorrect 114 ms 9592 KB Output isn't correct
15 Correct 119 ms 10872 KB Output is correct
16 Incorrect 184 ms 13176 KB Output isn't correct
17 Incorrect 231 ms 15508 KB Output isn't correct
18 Incorrect 187 ms 15600 KB Output isn't correct
19 Incorrect 216 ms 16760 KB Output isn't correct
20 Incorrect 211 ms 15352 KB Output isn't correct