답안 #890597

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
890597 2023-12-21T14:40:09 Z NoLove Rabbit Carrot (LMIO19_triusis) C++14
63 / 100
1000 ms 3928 KB
/**
 *    author : Lăng Trọng Đạt
 *    created: 21-12-2023 
**/
#include <bits/stdc++.h>
using namespace std;
#ifndef LANG_DAT
#define db(...) ;
#endif // LANG_DAT
#define int int64_t
#define mp make_pair
#define f first
#define s second
#define pb push_back
#define all(v) (v).begin(), (v).end()
using pii = pair<int, int>;

const int MAXN = 2e5 + 5;
int g[MAXN], dp[MAXN];
int n, x;

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    if (fopen("hi.inp", "r")) {
        freopen("hi.inp", "r", stdin);
//        freopen("hi.out", "w", stdout);
    } 

    cin >> n >> x;
    for (int i = 1; i <= n; i++) {
        cin >> g[i];
        g[i] -= i * x;
    }
    memset(dp, 0x3f3f, sizeof(dp));
    // if (g[1] > 0) {
    //     g[1] = 0;
    //     dp[1] = 1;
    // }
    // g[0] = -x;
    dp[0] = 0;
    for (int j = 1; j <= n + 1; j++) {
        for (int i = 0; i < j; i++) {
            if (g[i] >= g[j] or j == n + 1) {
                dp[j] = min(dp[j], dp[i] + (j - i - 1));
            }
        }
        db(dp[j])
    }
    cout << dp[n + 1];
}

Compilation message

triusis.cpp: In function 'int32_t main()':
triusis.cpp:25:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         freopen("hi.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2760 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2512 KB Output is correct
16 Correct 1 ms 2508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2760 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2512 KB Output is correct
16 Correct 1 ms 2508 KB Output is correct
17 Correct 1 ms 2512 KB Output is correct
18 Correct 1 ms 2652 KB Output is correct
19 Correct 1 ms 2652 KB Output is correct
20 Correct 9 ms 2704 KB Output is correct
21 Correct 12 ms 2704 KB Output is correct
22 Correct 34 ms 2692 KB Output is correct
23 Correct 13 ms 2720 KB Output is correct
24 Correct 14 ms 2648 KB Output is correct
25 Correct 12 ms 2648 KB Output is correct
26 Correct 13 ms 2652 KB Output is correct
27 Correct 15 ms 2652 KB Output is correct
28 Correct 14 ms 2648 KB Output is correct
29 Correct 12 ms 2652 KB Output is correct
30 Correct 13 ms 2712 KB Output is correct
31 Correct 10 ms 2716 KB Output is correct
32 Correct 14 ms 2652 KB Output is correct
33 Correct 13 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2512 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 9 ms 2704 KB Output is correct
5 Correct 12 ms 2704 KB Output is correct
6 Correct 34 ms 2692 KB Output is correct
7 Correct 13 ms 2720 KB Output is correct
8 Correct 14 ms 2648 KB Output is correct
9 Correct 12 ms 2648 KB Output is correct
10 Correct 13 ms 2652 KB Output is correct
11 Correct 15 ms 2652 KB Output is correct
12 Correct 14 ms 2648 KB Output is correct
13 Correct 12 ms 2652 KB Output is correct
14 Correct 13 ms 2712 KB Output is correct
15 Correct 10 ms 2716 KB Output is correct
16 Correct 14 ms 2652 KB Output is correct
17 Correct 13 ms 2652 KB Output is correct
18 Correct 1 ms 2648 KB Output is correct
19 Correct 1 ms 2652 KB Output is correct
20 Correct 1 ms 2652 KB Output is correct
21 Correct 1 ms 2652 KB Output is correct
22 Correct 1 ms 2652 KB Output is correct
23 Correct 1 ms 2652 KB Output is correct
24 Correct 1 ms 2648 KB Output is correct
25 Correct 1 ms 2648 KB Output is correct
26 Correct 1 ms 2760 KB Output is correct
27 Correct 1 ms 2652 KB Output is correct
28 Correct 1 ms 2652 KB Output is correct
29 Correct 1 ms 2652 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 1 ms 2652 KB Output is correct
32 Correct 1 ms 2512 KB Output is correct
33 Correct 1 ms 2508 KB Output is correct
34 Correct 34 ms 2652 KB Output is correct
35 Correct 35 ms 2648 KB Output is correct
36 Correct 34 ms 2652 KB Output is correct
37 Correct 13 ms 2648 KB Output is correct
38 Correct 15 ms 2648 KB Output is correct
39 Correct 13 ms 2648 KB Output is correct
40 Correct 10 ms 2652 KB Output is correct
41 Correct 13 ms 2716 KB Output is correct
42 Correct 13 ms 2648 KB Output is correct
43 Correct 13 ms 2720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 2652 KB Output is correct
2 Correct 35 ms 2648 KB Output is correct
3 Correct 34 ms 2652 KB Output is correct
4 Correct 13 ms 2648 KB Output is correct
5 Correct 15 ms 2648 KB Output is correct
6 Correct 13 ms 2648 KB Output is correct
7 Correct 10 ms 2652 KB Output is correct
8 Correct 13 ms 2716 KB Output is correct
9 Correct 13 ms 2648 KB Output is correct
10 Correct 13 ms 2720 KB Output is correct
11 Correct 1 ms 2512 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 9 ms 2704 KB Output is correct
15 Correct 12 ms 2704 KB Output is correct
16 Correct 34 ms 2692 KB Output is correct
17 Correct 13 ms 2720 KB Output is correct
18 Correct 14 ms 2648 KB Output is correct
19 Correct 12 ms 2648 KB Output is correct
20 Correct 13 ms 2652 KB Output is correct
21 Correct 15 ms 2652 KB Output is correct
22 Correct 14 ms 2648 KB Output is correct
23 Correct 12 ms 2652 KB Output is correct
24 Correct 13 ms 2712 KB Output is correct
25 Correct 10 ms 2716 KB Output is correct
26 Correct 14 ms 2652 KB Output is correct
27 Correct 13 ms 2652 KB Output is correct
28 Correct 1 ms 2648 KB Output is correct
29 Correct 1 ms 2652 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 1 ms 2652 KB Output is correct
32 Correct 1 ms 2652 KB Output is correct
33 Correct 1 ms 2652 KB Output is correct
34 Correct 1 ms 2648 KB Output is correct
35 Correct 1 ms 2648 KB Output is correct
36 Correct 1 ms 2760 KB Output is correct
37 Correct 1 ms 2652 KB Output is correct
38 Correct 1 ms 2652 KB Output is correct
39 Correct 1 ms 2652 KB Output is correct
40 Correct 1 ms 2652 KB Output is correct
41 Correct 1 ms 2652 KB Output is correct
42 Correct 1 ms 2512 KB Output is correct
43 Correct 1 ms 2508 KB Output is correct
44 Execution timed out 1027 ms 3928 KB Time limit exceeded
45 Halted 0 ms 0 KB -