답안 #626015

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
626015 2022-08-11T06:25:24 Z I_love_Hoang_Yen 송신탑 (IOI22_towers) C++17
11 / 100
4000 ms 1556 KB
#include "bits/stdc++.h"
using namespace std;

/*
// sub 1 {{{
int k = -1;
std::vector<int> a;

void init(int n, std::vector<int> _a) {
    assert((int) _a.size() == n);
    a = _a;
    k = max_element(a.begin(), a.end()) - a.begin();
}

int max_towers(int l, int r, int d) {
    if (k < l || r < k) return 1;
    if (a[l] <= a[k] - d && a[r] <= a[k] - d) return 2;
    return 1;
}
// }}}
*/

// sub 2 {{{
std::vector<int> a;

void init(int n, std::vector<int> _a) {
    assert((int) _a.size() == n);
    a = _a;
}

int max_towers(int l, int r, int d) {
    std::vector<int> f(a.size());
    for (int i = l; i <= r; ++i) {
        f[i] = 1;

        int max_tower = -1;
        for (int j = i - 1; j >= l; --j) {
            if (a[i] <= max_tower - d
                    && a[j] <= max_tower - d) {
                f[i] = std::max(f[i], f[j] + 1);
            }
            max_tower = std::max(max_tower, a[j]);
        }
    }
    return *max_element(f.begin(), f.end());
}
// }}}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4065 ms 996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 3 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 4 ms 208 KB Output is correct
17 Correct 2 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 7 ms 312 KB Output is correct
21 Correct 7 ms 208 KB Output is correct
22 Correct 7 ms 316 KB Output is correct
23 Correct 3 ms 304 KB Output is correct
24 Correct 4 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 208 KB Output is correct
27 Correct 7 ms 208 KB Output is correct
28 Correct 4 ms 208 KB Output is correct
29 Correct 3 ms 208 KB Output is correct
30 Correct 4 ms 208 KB Output is correct
31 Correct 5 ms 320 KB Output is correct
32 Correct 3 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 3 ms 208 KB Output is correct
35 Correct 3 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 3 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 4 ms 208 KB Output is correct
17 Correct 2 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 7 ms 312 KB Output is correct
21 Correct 7 ms 208 KB Output is correct
22 Correct 7 ms 316 KB Output is correct
23 Correct 3 ms 304 KB Output is correct
24 Correct 4 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 208 KB Output is correct
27 Correct 7 ms 208 KB Output is correct
28 Correct 4 ms 208 KB Output is correct
29 Correct 3 ms 208 KB Output is correct
30 Correct 4 ms 208 KB Output is correct
31 Correct 5 ms 320 KB Output is correct
32 Correct 3 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 3 ms 208 KB Output is correct
35 Correct 3 ms 208 KB Output is correct
36 Correct 553 ms 1068 KB Output is correct
37 Correct 1172 ms 1468 KB Output is correct
38 Correct 344 ms 1464 KB Output is correct
39 Correct 645 ms 1552 KB Output is correct
40 Correct 277 ms 1556 KB Output is correct
41 Execution timed out 4025 ms 1440 KB Time limit exceeded
42 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4024 ms 1456 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4070 ms 552 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 3 ms 208 KB Output is correct
3 Correct 2 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 4 ms 208 KB Output is correct
17 Correct 2 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 7 ms 312 KB Output is correct
21 Correct 7 ms 208 KB Output is correct
22 Correct 7 ms 316 KB Output is correct
23 Correct 3 ms 304 KB Output is correct
24 Correct 4 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 208 KB Output is correct
27 Correct 7 ms 208 KB Output is correct
28 Correct 4 ms 208 KB Output is correct
29 Correct 3 ms 208 KB Output is correct
30 Correct 4 ms 208 KB Output is correct
31 Correct 5 ms 320 KB Output is correct
32 Correct 3 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 3 ms 208 KB Output is correct
35 Correct 3 ms 208 KB Output is correct
36 Correct 553 ms 1068 KB Output is correct
37 Correct 1172 ms 1468 KB Output is correct
38 Correct 344 ms 1464 KB Output is correct
39 Correct 645 ms 1552 KB Output is correct
40 Correct 277 ms 1556 KB Output is correct
41 Execution timed out 4025 ms 1440 KB Time limit exceeded
42 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4065 ms 996 KB Time limit exceeded
2 Halted 0 ms 0 KB -