답안 #519123

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
519123 2022-01-25T17:18:57 Z blue Rabbit Carrot (LMIO19_triusis) C++17
63 / 100
1000 ms 2232 KB
#include <iostream>
#include <vector>
using namespace std;

using vi = vector<int>;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int N, M;
	cin >> N >> M;

	vi A(1+N);
	A[0] = 0;
	for(int i = 1; i <= N; i++) cin >> A[i];

	vi DP(1+N, 2*N);

	DP[0] = 0;

	int ans = N;

	for(int i = 1; i <= N; i++)
	{
		for(int j = 0; j < i; j++)
		{
			if(A[i] - A[j] <= M * (i - j))
			{
				DP[i] = min(DP[i], DP[j] + (i-1-j));
			}
		}

		ans = min(ans, DP[i] + N-i);

		// cerr << i << " : " << DP[i] << '\n';
	}

	cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 312 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 312 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 312 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 10 ms 352 KB Output is correct
21 Correct 15 ms 312 KB Output is correct
22 Correct 39 ms 332 KB Output is correct
23 Correct 17 ms 352 KB Output is correct
24 Correct 16 ms 332 KB Output is correct
25 Correct 16 ms 356 KB Output is correct
26 Correct 16 ms 316 KB Output is correct
27 Correct 29 ms 336 KB Output is correct
28 Correct 16 ms 332 KB Output is correct
29 Correct 16 ms 308 KB Output is correct
30 Correct 17 ms 312 KB Output is correct
31 Correct 15 ms 352 KB Output is correct
32 Correct 15 ms 332 KB Output is correct
33 Correct 16 ms 324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 10 ms 352 KB Output is correct
5 Correct 15 ms 312 KB Output is correct
6 Correct 39 ms 332 KB Output is correct
7 Correct 17 ms 352 KB Output is correct
8 Correct 16 ms 332 KB Output is correct
9 Correct 16 ms 356 KB Output is correct
10 Correct 16 ms 316 KB Output is correct
11 Correct 29 ms 336 KB Output is correct
12 Correct 16 ms 332 KB Output is correct
13 Correct 16 ms 308 KB Output is correct
14 Correct 17 ms 312 KB Output is correct
15 Correct 15 ms 352 KB Output is correct
16 Correct 15 ms 332 KB Output is correct
17 Correct 16 ms 324 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 312 KB Output is correct
31 Correct 1 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 41 ms 364 KB Output is correct
35 Correct 41 ms 376 KB Output is correct
36 Correct 40 ms 364 KB Output is correct
37 Correct 16 ms 332 KB Output is correct
38 Correct 32 ms 380 KB Output is correct
39 Correct 16 ms 356 KB Output is correct
40 Correct 13 ms 332 KB Output is correct
41 Correct 16 ms 356 KB Output is correct
42 Correct 16 ms 356 KB Output is correct
43 Correct 16 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 364 KB Output is correct
2 Correct 41 ms 376 KB Output is correct
3 Correct 40 ms 364 KB Output is correct
4 Correct 16 ms 332 KB Output is correct
5 Correct 32 ms 380 KB Output is correct
6 Correct 16 ms 356 KB Output is correct
7 Correct 13 ms 332 KB Output is correct
8 Correct 16 ms 356 KB Output is correct
9 Correct 16 ms 356 KB Output is correct
10 Correct 16 ms 332 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 10 ms 352 KB Output is correct
15 Correct 15 ms 312 KB Output is correct
16 Correct 39 ms 332 KB Output is correct
17 Correct 17 ms 352 KB Output is correct
18 Correct 16 ms 332 KB Output is correct
19 Correct 16 ms 356 KB Output is correct
20 Correct 16 ms 316 KB Output is correct
21 Correct 29 ms 336 KB Output is correct
22 Correct 16 ms 332 KB Output is correct
23 Correct 16 ms 308 KB Output is correct
24 Correct 17 ms 312 KB Output is correct
25 Correct 15 ms 352 KB Output is correct
26 Correct 15 ms 332 KB Output is correct
27 Correct 16 ms 324 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 0 ms 312 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Execution timed out 1032 ms 2232 KB Time limit exceeded
45 Halted 0 ms 0 KB -