Submission #131457

# Submission time Handle Problem Language Result Execution time Memory
131457 2019-07-17T07:26:43 Z 임유진(#3181) Sparklers (JOI17_sparklers) C++14
50 / 100
9 ms 4856 KB
#include <bits/stdc++.h>

using namespace std;

#define MAXN 1005

typedef long long lint;

lint X[MAXN];
lint dp[MAXN][MAXN];

lint di(lint a, lint b) {
	return a == 0 ? 0 : ((a - 1) / b + 1);
}

int main() {
	int N, K;
	lint T;

	scanf("%d%d%lld", &N, &K, &T);
	for(int i = 1; i <= N; i++) scanf("%lld", X + i);

	for(int i = K; i > 0; i--) for(int j = K; j <= N; j++) {
		if(i == K && j == K) dp[i][j] = 0ll;
		else if(i == K) dp[i][j] = max(dp[i][j - 1], di(X[j] - X[i], 2 * T * (j - i)));
		else if(j == K) dp[i][j] = max(dp[i + 1][j], di(X[j] - X[i], 2 * T * (j - i)));
		else dp[i][j] = max(min(dp[i + 1][j], dp[i][j - 1]), di(X[j] - X[i], 2 * T * (j - i)));
	}

	printf("%lld", dp[1][N]);
	return 0;
}

Compilation message

sparklers.cpp: In function 'int main()':
sparklers.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%lld", &N, &K, &T);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sparklers.cpp:21:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1; i <= N; i++) scanf("%lld", X + i);
                              ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 360 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 380 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 360 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 380 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 5 ms 2424 KB Output is correct
23 Correct 4 ms 1528 KB Output is correct
24 Correct 3 ms 760 KB Output is correct
25 Correct 2 ms 504 KB Output is correct
26 Correct 5 ms 1400 KB Output is correct
27 Correct 6 ms 1628 KB Output is correct
28 Correct 9 ms 4600 KB Output is correct
29 Correct 9 ms 4728 KB Output is correct
30 Correct 8 ms 4856 KB Output is correct
31 Correct 8 ms 4856 KB Output is correct
32 Correct 9 ms 3960 KB Output is correct
33 Correct 9 ms 3960 KB Output is correct
34 Correct 7 ms 4728 KB Output is correct
35 Correct 9 ms 4728 KB Output is correct
36 Correct 4 ms 1016 KB Output is correct
37 Correct 4 ms 932 KB Output is correct
38 Correct 9 ms 4728 KB Output is correct
39 Correct 6 ms 4472 KB Output is correct
40 Correct 5 ms 3192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 360 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 380 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 252 KB Output is correct
22 Correct 5 ms 2424 KB Output is correct
23 Correct 4 ms 1528 KB Output is correct
24 Correct 3 ms 760 KB Output is correct
25 Correct 2 ms 504 KB Output is correct
26 Correct 5 ms 1400 KB Output is correct
27 Correct 6 ms 1628 KB Output is correct
28 Correct 9 ms 4600 KB Output is correct
29 Correct 9 ms 4728 KB Output is correct
30 Correct 8 ms 4856 KB Output is correct
31 Correct 8 ms 4856 KB Output is correct
32 Correct 9 ms 3960 KB Output is correct
33 Correct 9 ms 3960 KB Output is correct
34 Correct 7 ms 4728 KB Output is correct
35 Correct 9 ms 4728 KB Output is correct
36 Correct 4 ms 1016 KB Output is correct
37 Correct 4 ms 932 KB Output is correct
38 Correct 9 ms 4728 KB Output is correct
39 Correct 6 ms 4472 KB Output is correct
40 Correct 5 ms 3192 KB Output is correct
41 Execution timed out 2 ms 504 KB Time limit exceeded (wall clock)
42 Halted 0 ms 0 KB -