# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
320858 | 2020-11-10T06:02:07 Z | knon0501 | Mountains (IOI17_mountains) | C++14 | 1000 ms | 512 KB |
#include "mountains.h" #include <vector> #include<bits/stdc++.h> using namespace std; long long a[2005]; int dp[2005][2005]; int visit[2005][2005]; int n; int f(int l,int r){ if(l>r)return 0; if(l==r)return 1; if(r==l+1)return 1; if(visit[l][r])return dp[l][r]; visit[l][r]=0; int i,j; for(i=l ; i<=r ; i++){ int k=i-1; int x=1; for(int j=i-2 ; j>=l ; j--){ if((a[i]-a[k])*(i-j)>=(a[i]-a[j])*(i-k)){ x+=f(j+1,k-1); k=j; } } x+=f(l,k-1); dp[l][r]=max(dp[l][r],x); } return dp[l][r]; } int maximum_deevs(std::vector<int> y) { n=y.size(); for(int i=1 ; i<=n ; i++) { a[i]=y[i-1]; } return f(1,n); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 14 ms | 364 KB | Output is correct |
18 | Correct | 19 ms | 364 KB | Output is correct |
19 | Correct | 12 ms | 364 KB | Output is correct |
20 | Correct | 16 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 3 ms | 364 KB | Output is correct |
28 | Correct | 2 ms | 364 KB | Output is correct |
29 | Correct | 1 ms | 364 KB | Output is correct |
30 | Correct | 1 ms | 364 KB | Output is correct |
31 | Correct | 1 ms | 364 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 918 ms | 484 KB | Output is correct |
34 | Correct | 6 ms | 364 KB | Output is correct |
35 | Correct | 2 ms | 364 KB | Output is correct |
36 | Correct | 563 ms | 480 KB | Output is correct |
37 | Correct | 914 ms | 484 KB | Output is correct |
38 | Correct | 339 ms | 392 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 14 ms | 364 KB | Output is correct |
18 | Correct | 19 ms | 364 KB | Output is correct |
19 | Correct | 12 ms | 364 KB | Output is correct |
20 | Correct | 16 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 3 ms | 364 KB | Output is correct |
28 | Correct | 2 ms | 364 KB | Output is correct |
29 | Correct | 1 ms | 364 KB | Output is correct |
30 | Correct | 1 ms | 364 KB | Output is correct |
31 | Correct | 1 ms | 364 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 918 ms | 484 KB | Output is correct |
34 | Correct | 6 ms | 364 KB | Output is correct |
35 | Correct | 2 ms | 364 KB | Output is correct |
36 | Correct | 563 ms | 480 KB | Output is correct |
37 | Correct | 914 ms | 484 KB | Output is correct |
38 | Correct | 339 ms | 392 KB | Output is correct |
39 | Execution timed out | 1094 ms | 404 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 512 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 14 ms | 364 KB | Output is correct |
18 | Correct | 19 ms | 364 KB | Output is correct |
19 | Correct | 12 ms | 364 KB | Output is correct |
20 | Correct | 16 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Correct | 3 ms | 364 KB | Output is correct |
28 | Correct | 2 ms | 364 KB | Output is correct |
29 | Correct | 1 ms | 364 KB | Output is correct |
30 | Correct | 1 ms | 364 KB | Output is correct |
31 | Correct | 1 ms | 364 KB | Output is correct |
32 | Correct | 1 ms | 364 KB | Output is correct |
33 | Correct | 918 ms | 484 KB | Output is correct |
34 | Correct | 6 ms | 364 KB | Output is correct |
35 | Correct | 2 ms | 364 KB | Output is correct |
36 | Correct | 563 ms | 480 KB | Output is correct |
37 | Correct | 914 ms | 484 KB | Output is correct |
38 | Correct | 339 ms | 392 KB | Output is correct |
39 | Execution timed out | 1094 ms | 404 KB | Time limit exceeded |
40 | Halted | 0 ms | 0 KB | - |