Submission #1056700

# Submission time Handle Problem Language Result Execution time Memory
1056700 2024-08-13T10:39:57 Z DorostWef Radio Towers (IOI22_towers) C++17
11 / 100
13 ms 2136 KB
#include "towers.h"

#include <bits/stdc++.h>

using namespace std;

const int N = 2002;
int h[N];
bool f[N];
int n;

void init(int N, std::vector<int> H) {
	n = N;
	for (int i = 0; i < n; i++)
		h[i] = H[i];
}

int solve (int l, int r, int d) {
	if (l > r)
		return 0;
	if (l == r)
		return f[l];
	int mx = -1, in = -1;
	int fin = 0;
	for (int i = l; i <= r; i++) {
		if (h[i] > mx) {
			mx = h[i];
			in = i;
		}
		fin |= f[i];
	}
	//if (f[in]) {
		for (int i = l; i <= r; i++) {
			if (h[i] > mx - d)
				f[i] = false;
		}
	//}
	return max (fin, solve (l, in - 1, d) + solve(in + 1, r, d));
}

int max_towers(int L, int R, int D) {
	for (int i = 0; i < N; i++)
		f[i] = true;
	return max (1, solve (L, R, D));
}
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 1368 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 504 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 504 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 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 6 ms 344 KB Output is correct
24 Correct 4 ms 524 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 600 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 4 ms 344 KB Output is correct
33 Correct 2 ms 344 KB Output is correct
34 Correct 2 ms 344 KB Output is correct
35 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 504 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 504 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 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 6 ms 344 KB Output is correct
24 Correct 4 ms 524 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 600 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 4 ms 344 KB Output is correct
33 Correct 2 ms 344 KB Output is correct
34 Correct 2 ms 344 KB Output is correct
35 Correct 3 ms 344 KB Output is correct
36 Runtime error 10 ms 1488 KB Execution killed with signal 11
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 2136 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 504 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 504 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 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 6 ms 344 KB Output is correct
24 Correct 4 ms 524 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 600 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 4 ms 344 KB Output is correct
33 Correct 2 ms 344 KB Output is correct
34 Correct 2 ms 344 KB Output is correct
35 Correct 3 ms 344 KB Output is correct
36 Runtime error 10 ms 1488 KB Execution killed with signal 11
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 1368 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -