답안 #689638

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
689638 2023-01-29T03:41:13 Z lohacho 송신탑 (IOI22_towers) C++17
11 / 100
4000 ms 8184 KB
#include "towers.h"

#include <bits/stdc++.h>
using namespace std;

int n;
vector<int> a;

void init(int N, std::vector<int> H) {
    n = N;
    a = H;
}

int max_towers(int L, int R, int D) {
    vector<vector<int>> srt;
    for(int i = L; i <= R; ++i){
        srt.push_back({a[i], i});
    }

    sort(srt.begin(), srt.end());

    vector<int> chk(n);
    for(int i = 0; i < (int)srt.size(); ++i){
        int now = srt[i][1];

        if(now < L || now > R){
            continue;
        }

        int r = now + 1, can = 1;
        while(r <= R && a[r] < a[now] + D){
            if(chk[r]){
                can = 0;

                break;
            }
            ++r;
        }

        int l = now - 1;
        while(l >= L && a[l] < a[now] + D){
            if(chk[l]){
                can = 0;

                break;
            }
            --l;
        }

        chk[now] = can;
    }

    return accumulate(chk.begin(), chk.end(), 0ll);
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4030 ms 3916 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 208 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 1 ms 304 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 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 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 3 ms 336 KB Output is correct
33 Correct 3 ms 336 KB Output is correct
34 Correct 3 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 208 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 1 ms 304 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 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 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 3 ms 336 KB Output is correct
33 Correct 3 ms 336 KB Output is correct
34 Correct 3 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 19 ms 2100 KB Output is correct
37 Correct 22 ms 3608 KB Output is correct
38 Correct 21 ms 2216 KB Output is correct
39 Correct 22 ms 3164 KB Output is correct
40 Correct 14 ms 2204 KB Output is correct
41 Correct 32 ms 6168 KB Output is correct
42 Correct 12 ms 1556 KB Output is correct
43 Correct 1655 ms 4156 KB Output is correct
44 Correct 142 ms 2248 KB Output is correct
45 Correct 16 ms 1608 KB Output is correct
46 Correct 13 ms 1556 KB Output is correct
47 Correct 19 ms 3604 KB Output is correct
48 Correct 16 ms 2856 KB Output is correct
49 Correct 13 ms 1808 KB Output is correct
50 Correct 258 ms 2880 KB Output is correct
51 Correct 292 ms 3612 KB Output is correct
52 Correct 35 ms 6924 KB Output is correct
53 Correct 34 ms 6920 KB Output is correct
54 Correct 40 ms 6928 KB Output is correct
55 Correct 2735 ms 6924 KB Output is correct
56 Correct 824 ms 6848 KB Output is correct
57 Correct 38 ms 6676 KB Output is correct
58 Correct 39 ms 6944 KB Output is correct
59 Correct 36 ms 6844 KB Output is correct
60 Correct 34 ms 6936 KB Output is correct
61 Correct 34 ms 6940 KB Output is correct
62 Correct 36 ms 6828 KB Output is correct
63 Correct 36 ms 7040 KB Output is correct
64 Execution timed out 4029 ms 6948 KB Time limit exceeded
65 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4042 ms 8184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4032 ms 2608 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 208 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 1 ms 304 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 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 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 3 ms 336 KB Output is correct
33 Correct 3 ms 336 KB Output is correct
34 Correct 3 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 19 ms 2100 KB Output is correct
37 Correct 22 ms 3608 KB Output is correct
38 Correct 21 ms 2216 KB Output is correct
39 Correct 22 ms 3164 KB Output is correct
40 Correct 14 ms 2204 KB Output is correct
41 Correct 32 ms 6168 KB Output is correct
42 Correct 12 ms 1556 KB Output is correct
43 Correct 1655 ms 4156 KB Output is correct
44 Correct 142 ms 2248 KB Output is correct
45 Correct 16 ms 1608 KB Output is correct
46 Correct 13 ms 1556 KB Output is correct
47 Correct 19 ms 3604 KB Output is correct
48 Correct 16 ms 2856 KB Output is correct
49 Correct 13 ms 1808 KB Output is correct
50 Correct 258 ms 2880 KB Output is correct
51 Correct 292 ms 3612 KB Output is correct
52 Correct 35 ms 6924 KB Output is correct
53 Correct 34 ms 6920 KB Output is correct
54 Correct 40 ms 6928 KB Output is correct
55 Correct 2735 ms 6924 KB Output is correct
56 Correct 824 ms 6848 KB Output is correct
57 Correct 38 ms 6676 KB Output is correct
58 Correct 39 ms 6944 KB Output is correct
59 Correct 36 ms 6844 KB Output is correct
60 Correct 34 ms 6936 KB Output is correct
61 Correct 34 ms 6940 KB Output is correct
62 Correct 36 ms 6828 KB Output is correct
63 Correct 36 ms 7040 KB Output is correct
64 Execution timed out 4029 ms 6948 KB Time limit exceeded
65 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4030 ms 3916 KB Time limit exceeded
2 Halted 0 ms 0 KB -