답안 #1067501

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1067501 2024-08-20T18:26:53 Z mariaclara 송신탑 (IOI22_towers) C++17
23 / 100
4000 ms 2392 KB
#include "towers.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second

vector<int> val_l, val_r, h;

void init(int N, vector<int> H) {
    val_l.resize(N);
    val_r.resize(N);
    h = H;

    for(int i = 0; i < N; i++) {
        if(i == 0 or H[i-1] < H[i]) val_l[i] = H[i];
        else val_l[i] = val_l[i-1];
    }

    for(int i = N-1; i >= 0; i--) {
        if(i == N-1 or H[i+1] < H[i]) val_r[i] = H[i];
        else val_r[i] = val_r[i+1];
    }
}

int max_towers(int L, int R, int D) {
    int ans = 0;

    for(int i = L, last = -1, m = 0; i <= R; i++) {
        if(last == -1 or min(m - h[last], m - h[i]) >= D) last = i, ans++, m = 0;
        if(h[i] < h[last]) last = i, m = 0;
        m = max(m, h[i]);
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1341 ms 1624 KB Output is correct
2 Execution timed out 4078 ms 2392 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 344 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 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 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 340 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 0 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 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 0 ms 344 KB Output is correct
32 Correct 0 ms 340 KB Output is correct
33 Correct 0 ms 340 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 344 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 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 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 340 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 0 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 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 0 ms 344 KB Output is correct
32 Correct 0 ms 340 KB Output is correct
33 Correct 0 ms 340 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 1624 KB Output is correct
37 Correct 9 ms 2364 KB Output is correct
38 Correct 9 ms 2392 KB Output is correct
39 Correct 9 ms 2392 KB Output is correct
40 Correct 9 ms 2392 KB Output is correct
41 Correct 9 ms 2316 KB Output is correct
42 Correct 9 ms 2392 KB Output is correct
43 Correct 9 ms 2392 KB Output is correct
44 Correct 9 ms 2224 KB Output is correct
45 Correct 9 ms 2392 KB Output is correct
46 Correct 9 ms 2392 KB Output is correct
47 Correct 17 ms 2392 KB Output is correct
48 Correct 9 ms 2392 KB Output is correct
49 Correct 9 ms 2360 KB Output is correct
50 Correct 16 ms 2392 KB Output is correct
51 Correct 9 ms 2392 KB Output is correct
52 Correct 17 ms 2368 KB Output is correct
53 Correct 9 ms 2220 KB Output is correct
54 Correct 9 ms 2392 KB Output is correct
55 Correct 9 ms 2392 KB Output is correct
56 Correct 9 ms 2392 KB Output is correct
57 Correct 9 ms 2136 KB Output is correct
58 Correct 17 ms 2208 KB Output is correct
59 Correct 16 ms 2392 KB Output is correct
60 Correct 9 ms 2392 KB Output is correct
61 Correct 9 ms 2220 KB Output is correct
62 Correct 9 ms 2392 KB Output is correct
63 Correct 9 ms 2392 KB Output is correct
64 Correct 15 ms 2356 KB Output is correct
65 Correct 9 ms 2392 KB Output is correct
66 Correct 9 ms 2264 KB Output is correct
67 Correct 9 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4072 ms 2136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2630 ms 876 KB Output is correct
2 Execution timed out 4005 ms 2392 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 344 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 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 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 340 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 0 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 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 0 ms 344 KB Output is correct
32 Correct 0 ms 340 KB Output is correct
33 Correct 0 ms 340 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 1624 KB Output is correct
37 Correct 9 ms 2364 KB Output is correct
38 Correct 9 ms 2392 KB Output is correct
39 Correct 9 ms 2392 KB Output is correct
40 Correct 9 ms 2392 KB Output is correct
41 Correct 9 ms 2316 KB Output is correct
42 Correct 9 ms 2392 KB Output is correct
43 Correct 9 ms 2392 KB Output is correct
44 Correct 9 ms 2224 KB Output is correct
45 Correct 9 ms 2392 KB Output is correct
46 Correct 9 ms 2392 KB Output is correct
47 Correct 17 ms 2392 KB Output is correct
48 Correct 9 ms 2392 KB Output is correct
49 Correct 9 ms 2360 KB Output is correct
50 Correct 16 ms 2392 KB Output is correct
51 Correct 9 ms 2392 KB Output is correct
52 Correct 17 ms 2368 KB Output is correct
53 Correct 9 ms 2220 KB Output is correct
54 Correct 9 ms 2392 KB Output is correct
55 Correct 9 ms 2392 KB Output is correct
56 Correct 9 ms 2392 KB Output is correct
57 Correct 9 ms 2136 KB Output is correct
58 Correct 17 ms 2208 KB Output is correct
59 Correct 16 ms 2392 KB Output is correct
60 Correct 9 ms 2392 KB Output is correct
61 Correct 9 ms 2220 KB Output is correct
62 Correct 9 ms 2392 KB Output is correct
63 Correct 9 ms 2392 KB Output is correct
64 Correct 15 ms 2356 KB Output is correct
65 Correct 9 ms 2392 KB Output is correct
66 Correct 9 ms 2264 KB Output is correct
67 Correct 9 ms 2392 KB Output is correct
68 Execution timed out 4072 ms 2136 KB Time limit exceeded
69 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1341 ms 1624 KB Output is correct
2 Execution timed out 4078 ms 2392 KB Time limit exceeded
3 Halted 0 ms 0 KB -