Submission #896852

# Submission time Handle Problem Language Result Execution time Memory
896852 2024-01-02T09:51:17 Z abcvuitunggio Radio Towers (IOI22_towers) C++17
23 / 100
4000 ms 3160 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
const int INF=2e9;
int l[100001],r[100001],a[100001],b[100001];
stack <int> st;
void init(int N, vector <int> H){
    for (int i=0;i<N;i++){
        a[i]=b[i]=H[i];
        r[i]=N-1;
        while (!st.empty()&&H[st.top()]>H[i]){
            r[st.top()]=i-1;
            a[i]=max(a[i],a[st.top()]);
            int x=b[st.top()];
            st.pop();
            if (!st.empty())
                b[st.top()]=max(b[st.top()],x);
        }
        l[i]=(st.empty()?0:st.top()+1);
        st.push(i);
    }
    for (int i=0;i<N;i++){
        a[i]-=H[i];
        b[i]-=H[i];
        if (!l[i])
            a[i]=INF;
        if (r[i]==N-1)
            b[i]=INF;
        l[i]--;
        r[i]++;
    }
}
int max_towers(int L, int R, int D){
    int res=0;
    for (int i=L;i<=R;i++){
        int x=INF,y=INF;
        if (l[i]>=L)
            x=a[i];
        if (r[i]<=R)
            y=b[i];
        res+=(min(x,y)>=D);
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1363 ms 1900 KB Output is correct
2 Execution timed out 4019 ms 3160 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 1 ms 392 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 432 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 388 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 1 ms 600 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 1 ms 392 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 432 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 388 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 1 ms 600 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 7 ms 1984 KB Output is correct
37 Correct 11 ms 2796 KB Output is correct
38 Correct 10 ms 2636 KB Output is correct
39 Correct 15 ms 2640 KB Output is correct
40 Correct 10 ms 2632 KB Output is correct
41 Correct 10 ms 2632 KB Output is correct
42 Correct 10 ms 2628 KB Output is correct
43 Correct 9 ms 3144 KB Output is correct
44 Correct 10 ms 2640 KB Output is correct
45 Correct 10 ms 2888 KB Output is correct
46 Correct 10 ms 2640 KB Output is correct
47 Correct 17 ms 2628 KB Output is correct
48 Correct 10 ms 2636 KB Output is correct
49 Correct 10 ms 2632 KB Output is correct
50 Correct 10 ms 2636 KB Output is correct
51 Correct 10 ms 3140 KB Output is correct
52 Correct 11 ms 2628 KB Output is correct
53 Correct 10 ms 2632 KB Output is correct
54 Correct 11 ms 2632 KB Output is correct
55 Correct 10 ms 2628 KB Output is correct
56 Correct 10 ms 3052 KB Output is correct
57 Correct 10 ms 2620 KB Output is correct
58 Correct 11 ms 2744 KB Output is correct
59 Correct 11 ms 2628 KB Output is correct
60 Correct 10 ms 2628 KB Output is correct
61 Correct 13 ms 2632 KB Output is correct
62 Correct 10 ms 2636 KB Output is correct
63 Correct 10 ms 2632 KB Output is correct
64 Correct 10 ms 3144 KB Output is correct
65 Correct 11 ms 2884 KB Output is correct
66 Correct 10 ms 3056 KB Output is correct
67 Correct 9 ms 2632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3360 ms 2632 KB Output is correct
2 Execution timed out 4083 ms 2632 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1035 ms 1008 KB Output is correct
2 Execution timed out 4016 ms 2636 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 1 ms 392 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 432 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 388 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 1 ms 600 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 7 ms 1984 KB Output is correct
37 Correct 11 ms 2796 KB Output is correct
38 Correct 10 ms 2636 KB Output is correct
39 Correct 15 ms 2640 KB Output is correct
40 Correct 10 ms 2632 KB Output is correct
41 Correct 10 ms 2632 KB Output is correct
42 Correct 10 ms 2628 KB Output is correct
43 Correct 9 ms 3144 KB Output is correct
44 Correct 10 ms 2640 KB Output is correct
45 Correct 10 ms 2888 KB Output is correct
46 Correct 10 ms 2640 KB Output is correct
47 Correct 17 ms 2628 KB Output is correct
48 Correct 10 ms 2636 KB Output is correct
49 Correct 10 ms 2632 KB Output is correct
50 Correct 10 ms 2636 KB Output is correct
51 Correct 10 ms 3140 KB Output is correct
52 Correct 11 ms 2628 KB Output is correct
53 Correct 10 ms 2632 KB Output is correct
54 Correct 11 ms 2632 KB Output is correct
55 Correct 10 ms 2628 KB Output is correct
56 Correct 10 ms 3052 KB Output is correct
57 Correct 10 ms 2620 KB Output is correct
58 Correct 11 ms 2744 KB Output is correct
59 Correct 11 ms 2628 KB Output is correct
60 Correct 10 ms 2628 KB Output is correct
61 Correct 13 ms 2632 KB Output is correct
62 Correct 10 ms 2636 KB Output is correct
63 Correct 10 ms 2632 KB Output is correct
64 Correct 10 ms 3144 KB Output is correct
65 Correct 11 ms 2884 KB Output is correct
66 Correct 10 ms 3056 KB Output is correct
67 Correct 9 ms 2632 KB Output is correct
68 Correct 3360 ms 2632 KB Output is correct
69 Execution timed out 4083 ms 2632 KB Time limit exceeded
70 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1363 ms 1900 KB Output is correct
2 Execution timed out 4019 ms 3160 KB Time limit exceeded
3 Halted 0 ms 0 KB -