Submission #732020

# Submission time Handle Problem Language Result Execution time Memory
732020 2023-04-28T08:53:39 Z alextodoran Radio Towers (IOI22_towers) C++17
11 / 100
4000 ms 5008 KB
/**
 _  _   __  _ _ _  _  _ _
 |a  ||t  ||o    d | |o  |
| __    _| | _ | __|  _ |
| __ |/_  | __  /__\ / _\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N_MAX = 100000;

int N;
int H[N_MAX];

void init (int _N, vector <int> _H) {
    N = _N;
    for (int i = 0; i < N; i++) {
        H[i] = _H[i];
    }
}

int max_towers (int L, int R, int D) {
    if (L > R) {
        return 0;
    }
    if (L == R) {
        return 1;
    }
    int K = L;
    for (int i = L + 1; i <= R; i++) {
        if (H[i] > H[K]) {
            K = i;
        }
    }
    int mnL = INT_MAX, mnR = INT_MAX;
    for (int i = L; i < K; i++) {
        mnL = min(mnL, H[i]);
    }
    for (int i = R; i > K; i--) {
        mnR = min(mnR, H[i]);
    }
    int mxtL = max_towers(L, K - 1, D);
    int mxtR = max_towers(K + 1, R, D);
    return (mnL <= H[K] - D && mnR <= H[K] - D ? mxtL + mxtR : max(mxtL, mxtR));
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4101 ms 4488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 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 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 4 ms 464 KB Output is correct
24 Correct 5 ms 336 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 208 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 4 ms 440 KB Output is correct
33 Correct 5 ms 392 KB Output is correct
34 Correct 6 ms 336 KB Output is correct
35 Correct 5 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 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 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 4 ms 464 KB Output is correct
24 Correct 5 ms 336 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 208 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 4 ms 440 KB Output is correct
33 Correct 5 ms 392 KB Output is correct
34 Correct 6 ms 336 KB Output is correct
35 Correct 5 ms 464 KB Output is correct
36 Correct 12 ms 956 KB Output is correct
37 Correct 20 ms 1336 KB Output is correct
38 Correct 20 ms 1456 KB Output is correct
39 Correct 14 ms 1460 KB Output is correct
40 Correct 14 ms 1460 KB Output is correct
41 Correct 17 ms 1468 KB Output is correct
42 Correct 11 ms 1464 KB Output is correct
43 Correct 1969 ms 5008 KB Output is correct
44 Correct 166 ms 2072 KB Output is correct
45 Correct 16 ms 1360 KB Output is correct
46 Correct 13 ms 1452 KB Output is correct
47 Correct 19 ms 1448 KB Output is correct
48 Correct 15 ms 1572 KB Output is correct
49 Correct 18 ms 1452 KB Output is correct
50 Correct 399 ms 2692 KB Output is correct
51 Correct 1174 ms 4012 KB Output is correct
52 Correct 16 ms 1472 KB Output is correct
53 Correct 26 ms 1352 KB Output is correct
54 Correct 18 ms 1564 KB Output is correct
55 Execution timed out 4035 ms 3224 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4027 ms 1448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4041 ms 464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 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 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 4 ms 464 KB Output is correct
24 Correct 5 ms 336 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 208 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 4 ms 440 KB Output is correct
33 Correct 5 ms 392 KB Output is correct
34 Correct 6 ms 336 KB Output is correct
35 Correct 5 ms 464 KB Output is correct
36 Correct 12 ms 956 KB Output is correct
37 Correct 20 ms 1336 KB Output is correct
38 Correct 20 ms 1456 KB Output is correct
39 Correct 14 ms 1460 KB Output is correct
40 Correct 14 ms 1460 KB Output is correct
41 Correct 17 ms 1468 KB Output is correct
42 Correct 11 ms 1464 KB Output is correct
43 Correct 1969 ms 5008 KB Output is correct
44 Correct 166 ms 2072 KB Output is correct
45 Correct 16 ms 1360 KB Output is correct
46 Correct 13 ms 1452 KB Output is correct
47 Correct 19 ms 1448 KB Output is correct
48 Correct 15 ms 1572 KB Output is correct
49 Correct 18 ms 1452 KB Output is correct
50 Correct 399 ms 2692 KB Output is correct
51 Correct 1174 ms 4012 KB Output is correct
52 Correct 16 ms 1472 KB Output is correct
53 Correct 26 ms 1352 KB Output is correct
54 Correct 18 ms 1564 KB Output is correct
55 Execution timed out 4035 ms 3224 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4101 ms 4488 KB Time limit exceeded
2 Halted 0 ms 0 KB -