답안 #394749

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
394749 2021-04-27T09:14:01 Z Qw3rTy Rabbit Carrot (LMIO19_triusis) C++11
63 / 100
1000 ms 1628 KB
#include <iostream>
using namespace std;

const int maxN = 2e5+5;

int f[maxN];
int a[maxN];
int N,M;

void testIO(){
    freopen("../test.in","r",stdin);
    return;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //testIO();
    cin >> N >> M;
    for(int i = 1; i <= N; ++i)cin >> a[i];
    a[0] = 0;
    f[0] = 0;
    for(int i = 1; i <= N; ++i){
        if(a[i] > M*i)continue;
        for(int j = 0; j < i; ++j){
            if(a[j] + M*(i-j) >= a[i])f[i] = max(f[i],f[j]+1);
        }
    }
    int res = 0;
    for(int i = 1; i <= N; ++i)res = max(res,f[i]);
    cout << N - res << '\n';
    return 0;
}

Compilation message

triusis.cpp: In function 'void testIO()':
triusis.cpp:11:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   11 |     freopen("../test.in","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 328 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 328 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 328 KB Output is correct
20 Correct 33 ms 332 KB Output is correct
21 Correct 48 ms 376 KB Output is correct
22 Correct 1 ms 360 KB Output is correct
23 Correct 51 ms 384 KB Output is correct
24 Correct 49 ms 332 KB Output is correct
25 Correct 49 ms 456 KB Output is correct
26 Correct 49 ms 332 KB Output is correct
27 Correct 34 ms 396 KB Output is correct
28 Correct 48 ms 388 KB Output is correct
29 Correct 50 ms 344 KB Output is correct
30 Correct 50 ms 376 KB Output is correct
31 Correct 31 ms 332 KB Output is correct
32 Correct 48 ms 380 KB Output is correct
33 Correct 49 ms 392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 33 ms 332 KB Output is correct
5 Correct 48 ms 376 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 51 ms 384 KB Output is correct
8 Correct 49 ms 332 KB Output is correct
9 Correct 49 ms 456 KB Output is correct
10 Correct 49 ms 332 KB Output is correct
11 Correct 34 ms 396 KB Output is correct
12 Correct 48 ms 388 KB Output is correct
13 Correct 50 ms 344 KB Output is correct
14 Correct 50 ms 376 KB Output is correct
15 Correct 31 ms 332 KB Output is correct
16 Correct 48 ms 380 KB Output is correct
17 Correct 49 ms 392 KB Output is correct
18 Correct 1 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 1 ms 328 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 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 1 ms 204 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 2 ms 332 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 49 ms 392 KB Output is correct
38 Correct 35 ms 336 KB Output is correct
39 Correct 48 ms 384 KB Output is correct
40 Correct 30 ms 332 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 48 ms 396 KB Output is correct
43 Correct 49 ms 388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 49 ms 392 KB Output is correct
5 Correct 35 ms 336 KB Output is correct
6 Correct 48 ms 384 KB Output is correct
7 Correct 30 ms 332 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 48 ms 396 KB Output is correct
10 Correct 49 ms 388 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 328 KB Output is correct
14 Correct 33 ms 332 KB Output is correct
15 Correct 48 ms 376 KB Output is correct
16 Correct 1 ms 360 KB Output is correct
17 Correct 51 ms 384 KB Output is correct
18 Correct 49 ms 332 KB Output is correct
19 Correct 49 ms 456 KB Output is correct
20 Correct 49 ms 332 KB Output is correct
21 Correct 34 ms 396 KB Output is correct
22 Correct 48 ms 388 KB Output is correct
23 Correct 50 ms 344 KB Output is correct
24 Correct 50 ms 376 KB Output is correct
25 Correct 31 ms 332 KB Output is correct
26 Correct 48 ms 380 KB Output is correct
27 Correct 49 ms 392 KB Output is correct
28 Correct 1 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 1 ms 328 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Execution timed out 1081 ms 1628 KB Time limit exceeded
45 Halted 0 ms 0 KB -