Submission #912280

# Submission time Handle Problem Language Result Execution time Memory
912280 2024-01-19T09:31:04 Z vjudge1 Rabbit Carrot (LMIO19_triusis) C++17
63 / 100
1000 ms 2856 KB
// #pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")  
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define sz(x) (int)x.size()
#define bit(a, i) ((a>>i)&1)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int P = 18;
const int K = 800;
const ll INF = 2e18;
const int inf = 1e9;
const int mod = 1e9+7;
const int maxm = 5e2+10;
const int maxn = 5e5+10;
const int dx[] = {0, 0, -1, 1};
const int dy[] = {1, -1, 0, 0};

int n, m;
int a[maxn];
int dp[maxn];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    int ans = n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
        dp[i] = inf;
        for(int j=0; j<i; j++){
            if((i-j)*1ll*m+a[j] >= a[i]){
                dp[i] = min(dp[j]+i-j-1, dp[i]);
            }
        } ans = min(ans, dp[i]+n-i);
    } cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2440 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2440 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 11 ms 2396 KB Output is correct
21 Correct 16 ms 2396 KB Output is correct
22 Correct 35 ms 2396 KB Output is correct
23 Correct 16 ms 2396 KB Output is correct
24 Correct 16 ms 2396 KB Output is correct
25 Correct 19 ms 2784 KB Output is correct
26 Correct 17 ms 2396 KB Output is correct
27 Correct 16 ms 2392 KB Output is correct
28 Correct 16 ms 2396 KB Output is correct
29 Correct 16 ms 2392 KB Output is correct
30 Correct 16 ms 2396 KB Output is correct
31 Correct 12 ms 2396 KB Output is correct
32 Correct 16 ms 2396 KB Output is correct
33 Correct 17 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 11 ms 2396 KB Output is correct
5 Correct 16 ms 2396 KB Output is correct
6 Correct 35 ms 2396 KB Output is correct
7 Correct 16 ms 2396 KB Output is correct
8 Correct 16 ms 2396 KB Output is correct
9 Correct 19 ms 2784 KB Output is correct
10 Correct 17 ms 2396 KB Output is correct
11 Correct 16 ms 2392 KB Output is correct
12 Correct 16 ms 2396 KB Output is correct
13 Correct 16 ms 2392 KB Output is correct
14 Correct 16 ms 2396 KB Output is correct
15 Correct 12 ms 2396 KB Output is correct
16 Correct 16 ms 2396 KB Output is correct
17 Correct 17 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2392 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2440 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2392 KB Output is correct
34 Correct 37 ms 2396 KB Output is correct
35 Correct 35 ms 2392 KB Output is correct
36 Correct 36 ms 2396 KB Output is correct
37 Correct 16 ms 2392 KB Output is correct
38 Correct 17 ms 2392 KB Output is correct
39 Correct 18 ms 2528 KB Output is correct
40 Correct 12 ms 2392 KB Output is correct
41 Correct 16 ms 2392 KB Output is correct
42 Correct 16 ms 2396 KB Output is correct
43 Correct 16 ms 2528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 2396 KB Output is correct
2 Correct 35 ms 2392 KB Output is correct
3 Correct 36 ms 2396 KB Output is correct
4 Correct 16 ms 2392 KB Output is correct
5 Correct 17 ms 2392 KB Output is correct
6 Correct 18 ms 2528 KB Output is correct
7 Correct 12 ms 2392 KB Output is correct
8 Correct 16 ms 2392 KB Output is correct
9 Correct 16 ms 2396 KB Output is correct
10 Correct 16 ms 2528 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 11 ms 2396 KB Output is correct
15 Correct 16 ms 2396 KB Output is correct
16 Correct 35 ms 2396 KB Output is correct
17 Correct 16 ms 2396 KB Output is correct
18 Correct 16 ms 2396 KB Output is correct
19 Correct 19 ms 2784 KB Output is correct
20 Correct 17 ms 2396 KB Output is correct
21 Correct 16 ms 2392 KB Output is correct
22 Correct 16 ms 2396 KB Output is correct
23 Correct 16 ms 2392 KB Output is correct
24 Correct 16 ms 2396 KB Output is correct
25 Correct 12 ms 2396 KB Output is correct
26 Correct 16 ms 2396 KB Output is correct
27 Correct 17 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 1 ms 2396 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 1 ms 2396 KB Output is correct
39 Correct 1 ms 2440 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2392 KB Output is correct
44 Execution timed out 1050 ms 2856 KB Time limit exceeded
45 Halted 0 ms 0 KB -