Submission #763534

# Submission time Handle Problem Language Result Execution time Memory
763534 2023-06-22T12:24:28 Z drdilyor Radio Towers (IOI22_towers) C++17
23 / 100
4000 ms 1872 KB
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;
using ll = long long;

int n;
vector<int> h, ix;
void init(int N, std::vector<int> H) {
    n = N, h = H;
    ix.resize(n);
    iota(ix.begin(), ix.end(), 0);
    sort(ix.begin(), ix.end(), [&](int i, int j) {
            return h[i] < h[j];
            });
}

int max_towers(int L, int R, int D) {
    int res = 0;
    for (int i_ = 0; i_ < n; i_++) {
        int i = ix[i_];
        if (i < L || i > R) continue;
        bool ok = 1;
        for (int j = i; j >= L; j--) {
            if (h[j] < h[i]) {
                ok = 0; break;
            }
            else if (h[j] - h[i] >= D)
                break;
        }
        for (int j = i; j <= R; j++) {
            if (h[j] < h[i]) {ok = 0;break;}
            else if (h[j] - h[i] >= D) break;
        }
        res += ok;
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4016 ms 1232 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 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 1 ms 208 KB Output is correct
17 Correct 1 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 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 1 ms 208 KB Output is correct
24 Correct 0 ms 208 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 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 328 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 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 1 ms 208 KB Output is correct
17 Correct 1 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 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 1 ms 208 KB Output is correct
24 Correct 0 ms 208 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 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 328 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 13 ms 1352 KB Output is correct
37 Correct 18 ms 1840 KB Output is correct
38 Correct 23 ms 1848 KB Output is correct
39 Correct 17 ms 1872 KB Output is correct
40 Correct 17 ms 1848 KB Output is correct
41 Correct 23 ms 1856 KB Output is correct
42 Correct 17 ms 1816 KB Output is correct
43 Correct 379 ms 1848 KB Output is correct
44 Correct 67 ms 1744 KB Output is correct
45 Correct 12 ms 1828 KB Output is correct
46 Correct 18 ms 1816 KB Output is correct
47 Correct 18 ms 1816 KB Output is correct
48 Correct 23 ms 1736 KB Output is correct
49 Correct 17 ms 1824 KB Output is correct
50 Correct 14 ms 1840 KB Output is correct
51 Correct 11 ms 1872 KB Output is correct
52 Correct 18 ms 1828 KB Output is correct
53 Correct 17 ms 1868 KB Output is correct
54 Correct 17 ms 1856 KB Output is correct
55 Correct 10 ms 1872 KB Output is correct
56 Correct 11 ms 1824 KB Output is correct
57 Correct 18 ms 1824 KB Output is correct
58 Correct 23 ms 1848 KB Output is correct
59 Correct 18 ms 1736 KB Output is correct
60 Correct 21 ms 1816 KB Output is correct
61 Correct 21 ms 1828 KB Output is correct
62 Correct 23 ms 1820 KB Output is correct
63 Correct 17 ms 1816 KB Output is correct
64 Correct 1780 ms 1736 KB Output is correct
65 Correct 2557 ms 1824 KB Output is correct
66 Correct 656 ms 1824 KB Output is correct
67 Correct 2308 ms 1848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4089 ms 1736 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4090 ms 592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 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 1 ms 208 KB Output is correct
17 Correct 1 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 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 1 ms 208 KB Output is correct
24 Correct 0 ms 208 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 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 328 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 13 ms 1352 KB Output is correct
37 Correct 18 ms 1840 KB Output is correct
38 Correct 23 ms 1848 KB Output is correct
39 Correct 17 ms 1872 KB Output is correct
40 Correct 17 ms 1848 KB Output is correct
41 Correct 23 ms 1856 KB Output is correct
42 Correct 17 ms 1816 KB Output is correct
43 Correct 379 ms 1848 KB Output is correct
44 Correct 67 ms 1744 KB Output is correct
45 Correct 12 ms 1828 KB Output is correct
46 Correct 18 ms 1816 KB Output is correct
47 Correct 18 ms 1816 KB Output is correct
48 Correct 23 ms 1736 KB Output is correct
49 Correct 17 ms 1824 KB Output is correct
50 Correct 14 ms 1840 KB Output is correct
51 Correct 11 ms 1872 KB Output is correct
52 Correct 18 ms 1828 KB Output is correct
53 Correct 17 ms 1868 KB Output is correct
54 Correct 17 ms 1856 KB Output is correct
55 Correct 10 ms 1872 KB Output is correct
56 Correct 11 ms 1824 KB Output is correct
57 Correct 18 ms 1824 KB Output is correct
58 Correct 23 ms 1848 KB Output is correct
59 Correct 18 ms 1736 KB Output is correct
60 Correct 21 ms 1816 KB Output is correct
61 Correct 21 ms 1828 KB Output is correct
62 Correct 23 ms 1820 KB Output is correct
63 Correct 17 ms 1816 KB Output is correct
64 Correct 1780 ms 1736 KB Output is correct
65 Correct 2557 ms 1824 KB Output is correct
66 Correct 656 ms 1824 KB Output is correct
67 Correct 2308 ms 1848 KB Output is correct
68 Execution timed out 4089 ms 1736 KB Time limit exceeded
69 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4016 ms 1232 KB Time limit exceeded
2 Halted 0 ms 0 KB -