Submission #67984

# Submission time Handle Problem Language Result Execution time Memory
67984 2018-08-15T16:35:38 Z win11905 Mountains (IOI17_mountains) C++11
100 / 100
52 ms 15228 KB
#include "mountains.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 2005;

int n, dp[N][N];

int maximum_deevs(vector<int> y) {
	n = y.size();
	for(int r = 1; r <= n; ++r) {
		dp[r][r] = dp[r-1][r] = 1;
		int m = r-1, sum = 0;
		for(int l = r-2; l > 0; --l) {
			if(1ll*(m-r)*(y[l-1]-y[r-1]) <= 1ll*(l-r)*(y[m-1]-y[r-1])) {
				sum += dp[l+1][m-1];
				m = l;
			}		
			dp[l][r] = max(dp[l][r-1], dp[l][m-1] + sum + 1);
		}
	}
	return dp[1][n];
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 3 ms 572 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 3 ms 760 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
11 Correct 3 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 3 ms 764 KB Output is correct
14 Correct 3 ms 824 KB Output is correct
15 Correct 2 ms 824 KB Output is correct
16 Correct 3 ms 824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 3 ms 572 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 3 ms 760 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
11 Correct 3 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 3 ms 764 KB Output is correct
14 Correct 3 ms 824 KB Output is correct
15 Correct 2 ms 824 KB Output is correct
16 Correct 3 ms 824 KB Output is correct
17 Correct 3 ms 908 KB Output is correct
18 Correct 3 ms 912 KB Output is correct
19 Correct 4 ms 916 KB Output is correct
20 Correct 3 ms 940 KB Output is correct
21 Correct 3 ms 944 KB Output is correct
22 Correct 2 ms 944 KB Output is correct
23 Correct 4 ms 952 KB Output is correct
24 Correct 4 ms 952 KB Output is correct
25 Correct 3 ms 960 KB Output is correct
26 Correct 3 ms 964 KB Output is correct
27 Correct 2 ms 968 KB Output is correct
28 Correct 3 ms 972 KB Output is correct
29 Correct 3 ms 976 KB Output is correct
30 Correct 3 ms 980 KB Output is correct
31 Correct 3 ms 984 KB Output is correct
32 Correct 3 ms 988 KB Output is correct
33 Correct 3 ms 992 KB Output is correct
34 Correct 2 ms 1000 KB Output is correct
35 Correct 2 ms 1000 KB Output is correct
36 Correct 4 ms 1004 KB Output is correct
37 Correct 3 ms 1008 KB Output is correct
38 Correct 2 ms 1012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 3 ms 572 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 3 ms 760 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
11 Correct 3 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 3 ms 764 KB Output is correct
14 Correct 3 ms 824 KB Output is correct
15 Correct 2 ms 824 KB Output is correct
16 Correct 3 ms 824 KB Output is correct
17 Correct 3 ms 908 KB Output is correct
18 Correct 3 ms 912 KB Output is correct
19 Correct 4 ms 916 KB Output is correct
20 Correct 3 ms 940 KB Output is correct
21 Correct 3 ms 944 KB Output is correct
22 Correct 2 ms 944 KB Output is correct
23 Correct 4 ms 952 KB Output is correct
24 Correct 4 ms 952 KB Output is correct
25 Correct 3 ms 960 KB Output is correct
26 Correct 3 ms 964 KB Output is correct
27 Correct 2 ms 968 KB Output is correct
28 Correct 3 ms 972 KB Output is correct
29 Correct 3 ms 976 KB Output is correct
30 Correct 3 ms 980 KB Output is correct
31 Correct 3 ms 984 KB Output is correct
32 Correct 3 ms 988 KB Output is correct
33 Correct 3 ms 992 KB Output is correct
34 Correct 2 ms 1000 KB Output is correct
35 Correct 2 ms 1000 KB Output is correct
36 Correct 4 ms 1004 KB Output is correct
37 Correct 3 ms 1008 KB Output is correct
38 Correct 2 ms 1012 KB Output is correct
39 Correct 3 ms 1656 KB Output is correct
40 Correct 4 ms 2176 KB Output is correct
41 Correct 4 ms 2176 KB Output is correct
42 Correct 4 ms 2180 KB Output is correct
43 Correct 4 ms 2180 KB Output is correct
44 Correct 4 ms 2188 KB Output is correct
45 Correct 4 ms 2192 KB Output is correct
46 Correct 4 ms 2196 KB Output is correct
47 Correct 4 ms 2200 KB Output is correct
48 Correct 4 ms 2204 KB Output is correct
49 Correct 4 ms 2248 KB Output is correct
50 Correct 4 ms 2248 KB Output is correct
51 Correct 4 ms 2248 KB Output is correct
52 Correct 5 ms 2248 KB Output is correct
53 Correct 4 ms 2248 KB Output is correct
54 Correct 4 ms 2248 KB Output is correct
55 Correct 4 ms 2248 KB Output is correct
56 Correct 3 ms 2248 KB Output is correct
57 Correct 4 ms 2248 KB Output is correct
58 Correct 4 ms 2248 KB Output is correct
59 Correct 4 ms 2248 KB Output is correct
60 Correct 4 ms 2248 KB Output is correct
61 Correct 4 ms 2256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 3 ms 572 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 3 ms 760 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
11 Correct 3 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 3 ms 764 KB Output is correct
14 Correct 3 ms 824 KB Output is correct
15 Correct 2 ms 824 KB Output is correct
16 Correct 3 ms 824 KB Output is correct
17 Correct 3 ms 908 KB Output is correct
18 Correct 3 ms 912 KB Output is correct
19 Correct 4 ms 916 KB Output is correct
20 Correct 3 ms 940 KB Output is correct
21 Correct 3 ms 944 KB Output is correct
22 Correct 2 ms 944 KB Output is correct
23 Correct 4 ms 952 KB Output is correct
24 Correct 4 ms 952 KB Output is correct
25 Correct 3 ms 960 KB Output is correct
26 Correct 3 ms 964 KB Output is correct
27 Correct 2 ms 968 KB Output is correct
28 Correct 3 ms 972 KB Output is correct
29 Correct 3 ms 976 KB Output is correct
30 Correct 3 ms 980 KB Output is correct
31 Correct 3 ms 984 KB Output is correct
32 Correct 3 ms 988 KB Output is correct
33 Correct 3 ms 992 KB Output is correct
34 Correct 2 ms 1000 KB Output is correct
35 Correct 2 ms 1000 KB Output is correct
36 Correct 4 ms 1004 KB Output is correct
37 Correct 3 ms 1008 KB Output is correct
38 Correct 2 ms 1012 KB Output is correct
39 Correct 3 ms 1656 KB Output is correct
40 Correct 4 ms 2176 KB Output is correct
41 Correct 4 ms 2176 KB Output is correct
42 Correct 4 ms 2180 KB Output is correct
43 Correct 4 ms 2180 KB Output is correct
44 Correct 4 ms 2188 KB Output is correct
45 Correct 4 ms 2192 KB Output is correct
46 Correct 4 ms 2196 KB Output is correct
47 Correct 4 ms 2200 KB Output is correct
48 Correct 4 ms 2204 KB Output is correct
49 Correct 4 ms 2248 KB Output is correct
50 Correct 4 ms 2248 KB Output is correct
51 Correct 4 ms 2248 KB Output is correct
52 Correct 5 ms 2248 KB Output is correct
53 Correct 4 ms 2248 KB Output is correct
54 Correct 4 ms 2248 KB Output is correct
55 Correct 4 ms 2248 KB Output is correct
56 Correct 3 ms 2248 KB Output is correct
57 Correct 4 ms 2248 KB Output is correct
58 Correct 4 ms 2248 KB Output is correct
59 Correct 4 ms 2248 KB Output is correct
60 Correct 4 ms 2248 KB Output is correct
61 Correct 4 ms 2256 KB Output is correct
62 Correct 13 ms 6868 KB Output is correct
63 Correct 36 ms 14816 KB Output is correct
64 Correct 44 ms 14852 KB Output is correct
65 Correct 38 ms 14908 KB Output is correct
66 Correct 28 ms 14924 KB Output is correct
67 Correct 32 ms 14924 KB Output is correct
68 Correct 35 ms 14964 KB Output is correct
69 Correct 35 ms 14984 KB Output is correct
70 Correct 41 ms 14984 KB Output is correct
71 Correct 43 ms 15020 KB Output is correct
72 Correct 41 ms 15160 KB Output is correct
73 Correct 41 ms 15184 KB Output is correct
74 Correct 39 ms 15184 KB Output is correct
75 Correct 43 ms 15184 KB Output is correct
76 Correct 42 ms 15184 KB Output is correct
77 Correct 47 ms 15184 KB Output is correct
78 Correct 46 ms 15184 KB Output is correct
79 Correct 52 ms 15184 KB Output is correct
80 Correct 46 ms 15184 KB Output is correct
81 Correct 41 ms 15184 KB Output is correct
82 Correct 30 ms 15184 KB Output is correct
83 Correct 32 ms 15196 KB Output is correct
84 Correct 32 ms 15200 KB Output is correct
85 Correct 41 ms 15216 KB Output is correct
86 Correct 32 ms 15228 KB Output is correct