답안 #732027

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
732027 2023-04-28T09:01:01 Z alextodoran 송신탑 (IOI22_towers) C++17
23 / 100
4000 ms 19072 KB
/**
 _  _   __  _ _ _  _  _ _
 |a  ||t  ||o    d | |o  |
| __    _| | _ | __|  _ |
| __ |/_  | __  /__\ / _\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N_MAX = 100000;
const int E_MAX = 17;

int N;
int H[N_MAX];

int rmx[N_MAX][E_MAX];
int rmn[N_MAX][E_MAX];

int fmx (int i, int j) {
    return (H[i] > H[j] ? i : j);
}
int fmn (int i, int j) {
    return (H[i] < H[j] ? i : j);
}

void init (int _N, vector <int> _H) {
    N = _N;
    for (int i = 0; i < N; i++) {
        H[i] = _H[i];
        rmx[i][0] = rmn[i][0] = i;
    }
    for (int e = 1; e < E_MAX; e++) {
        for (int i = 0; i + (1 << e) - 1 < N; i++) {
            rmx[i][e] = fmx(rmx[i][e - 1], rmx[i + (1 << (e - 1))][e - 1]);
            rmn[i][e] = fmn(rmn[i][e - 1], rmn[i + (1 << (e - 1))][e - 1]);
        }
    }
}

int getmx (int l, int r) {
    int e = 31 - __builtin_clz(r - l + 1);
    return fmx(rmx[l][e], rmx[r - (1 << e) + 1][e]);
}
int getmn (int l, int r) {
    int e = 31 - __builtin_clz(r - l + 1);
    return fmn(rmn[l][e], rmn[r - (1 << e) + 1][e]);
}

int max_towers (int L, int R, int D) {
    if (L > R) {
        return 0;
    }
    if (L == R) {
        return 1;
    }
    int K = getmx(L, R);
    int mxtL = max_towers(L, K - 1, D);
    int mxtR = max_towers(K + 1, R, D);
    return (H[getmn(L, K)] <= H[K] - D && H[getmn(K, R)] <= H[K] - D ? mxtL + mxtR : max(mxtL, mxtR));
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4064 ms 10992 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 592 KB Output is correct
4 Correct 1 ms 640 KB Output is correct
5 Correct 1 ms 592 KB Output is correct
6 Correct 1 ms 592 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 592 KB Output is correct
10 Correct 1 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 592 KB Output is correct
14 Correct 1 ms 592 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 2 ms 592 KB Output is correct
17 Correct 1 ms 592 KB Output is correct
18 Correct 1 ms 612 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 1 ms 592 KB Output is correct
21 Correct 1 ms 592 KB Output is correct
22 Correct 1 ms 592 KB Output is correct
23 Correct 1 ms 592 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 592 KB Output is correct
27 Correct 1 ms 592 KB Output is correct
28 Correct 1 ms 592 KB Output is correct
29 Correct 1 ms 592 KB Output is correct
30 Correct 1 ms 592 KB Output is correct
31 Correct 1 ms 592 KB Output is correct
32 Correct 1 ms 592 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 592 KB Output is correct
4 Correct 1 ms 640 KB Output is correct
5 Correct 1 ms 592 KB Output is correct
6 Correct 1 ms 592 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 592 KB Output is correct
10 Correct 1 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 592 KB Output is correct
14 Correct 1 ms 592 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 2 ms 592 KB Output is correct
17 Correct 1 ms 592 KB Output is correct
18 Correct 1 ms 612 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 1 ms 592 KB Output is correct
21 Correct 1 ms 592 KB Output is correct
22 Correct 1 ms 592 KB Output is correct
23 Correct 1 ms 592 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 592 KB Output is correct
27 Correct 1 ms 592 KB Output is correct
28 Correct 1 ms 592 KB Output is correct
29 Correct 1 ms 592 KB Output is correct
30 Correct 1 ms 592 KB Output is correct
31 Correct 1 ms 592 KB Output is correct
32 Correct 1 ms 592 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 676 KB Output is correct
36 Correct 21 ms 9652 KB Output is correct
37 Correct 33 ms 14756 KB Output is correct
38 Correct 36 ms 14756 KB Output is correct
39 Correct 34 ms 14664 KB Output is correct
40 Correct 34 ms 14672 KB Output is correct
41 Correct 33 ms 14664 KB Output is correct
42 Correct 31 ms 14768 KB Output is correct
43 Correct 46 ms 16688 KB Output is correct
44 Correct 35 ms 15028 KB Output is correct
45 Correct 41 ms 14752 KB Output is correct
46 Correct 33 ms 14664 KB Output is correct
47 Correct 33 ms 14760 KB Output is correct
48 Correct 34 ms 14784 KB Output is correct
49 Correct 34 ms 14756 KB Output is correct
50 Correct 38 ms 15316 KB Output is correct
51 Correct 33 ms 16168 KB Output is correct
52 Correct 37 ms 14760 KB Output is correct
53 Correct 35 ms 14776 KB Output is correct
54 Correct 37 ms 14760 KB Output is correct
55 Correct 41 ms 18972 KB Output is correct
56 Correct 37 ms 18588 KB Output is correct
57 Correct 33 ms 14312 KB Output is correct
58 Correct 39 ms 14672 KB Output is correct
59 Correct 36 ms 14780 KB Output is correct
60 Correct 41 ms 14672 KB Output is correct
61 Correct 38 ms 14756 KB Output is correct
62 Correct 34 ms 14744 KB Output is correct
63 Correct 44 ms 14648 KB Output is correct
64 Correct 42 ms 18976 KB Output is correct
65 Correct 37 ms 19072 KB Output is correct
66 Correct 48 ms 17188 KB Output is correct
67 Correct 52 ms 18716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4088 ms 14672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4088 ms 3664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 592 KB Output is correct
4 Correct 1 ms 640 KB Output is correct
5 Correct 1 ms 592 KB Output is correct
6 Correct 1 ms 592 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 592 KB Output is correct
10 Correct 1 ms 592 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 592 KB Output is correct
14 Correct 1 ms 592 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 2 ms 592 KB Output is correct
17 Correct 1 ms 592 KB Output is correct
18 Correct 1 ms 612 KB Output is correct
19 Correct 1 ms 592 KB Output is correct
20 Correct 1 ms 592 KB Output is correct
21 Correct 1 ms 592 KB Output is correct
22 Correct 1 ms 592 KB Output is correct
23 Correct 1 ms 592 KB Output is correct
24 Correct 1 ms 592 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 592 KB Output is correct
27 Correct 1 ms 592 KB Output is correct
28 Correct 1 ms 592 KB Output is correct
29 Correct 1 ms 592 KB Output is correct
30 Correct 1 ms 592 KB Output is correct
31 Correct 1 ms 592 KB Output is correct
32 Correct 1 ms 592 KB Output is correct
33 Correct 1 ms 592 KB Output is correct
34 Correct 1 ms 592 KB Output is correct
35 Correct 1 ms 676 KB Output is correct
36 Correct 21 ms 9652 KB Output is correct
37 Correct 33 ms 14756 KB Output is correct
38 Correct 36 ms 14756 KB Output is correct
39 Correct 34 ms 14664 KB Output is correct
40 Correct 34 ms 14672 KB Output is correct
41 Correct 33 ms 14664 KB Output is correct
42 Correct 31 ms 14768 KB Output is correct
43 Correct 46 ms 16688 KB Output is correct
44 Correct 35 ms 15028 KB Output is correct
45 Correct 41 ms 14752 KB Output is correct
46 Correct 33 ms 14664 KB Output is correct
47 Correct 33 ms 14760 KB Output is correct
48 Correct 34 ms 14784 KB Output is correct
49 Correct 34 ms 14756 KB Output is correct
50 Correct 38 ms 15316 KB Output is correct
51 Correct 33 ms 16168 KB Output is correct
52 Correct 37 ms 14760 KB Output is correct
53 Correct 35 ms 14776 KB Output is correct
54 Correct 37 ms 14760 KB Output is correct
55 Correct 41 ms 18972 KB Output is correct
56 Correct 37 ms 18588 KB Output is correct
57 Correct 33 ms 14312 KB Output is correct
58 Correct 39 ms 14672 KB Output is correct
59 Correct 36 ms 14780 KB Output is correct
60 Correct 41 ms 14672 KB Output is correct
61 Correct 38 ms 14756 KB Output is correct
62 Correct 34 ms 14744 KB Output is correct
63 Correct 44 ms 14648 KB Output is correct
64 Correct 42 ms 18976 KB Output is correct
65 Correct 37 ms 19072 KB Output is correct
66 Correct 48 ms 17188 KB Output is correct
67 Correct 52 ms 18716 KB Output is correct
68 Execution timed out 4088 ms 14672 KB Time limit exceeded
69 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4064 ms 10992 KB Time limit exceeded
2 Halted 0 ms 0 KB -