Submission #753839

# Submission time Handle Problem Language Result Execution time Memory
753839 2023-06-06T07:27:16 Z blue Radio Towers (IOI22_towers) C++17
11 / 100
4000 ms 1468 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
 
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
 
int N;
vi H;
 
vi LS, RS;
 
vll dist, dist2;
 
 
void init(int N_, vi H_)
{
	N = N_;
	H = H_;
}
 
int max_towers(int L, int R, int D)
{
	vi dp(N, 0);

	int res = 0;

	for(int i = L; i <= R; i++)
	{
		dp[i] = 1;

		int mx = 0;

		for(int j = i-1; j >= L; j--)
		{
			if(mx - max(H[i], H[j]) >= D)
				dp[i] = max(dp[i], 1 + dp[j]);

			mx = max(mx, H[j]);
		}

		res = max(res, dp[i]);
	}

	return res;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4051 ms 996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 2 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 220 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 2 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 5 ms 208 KB Output is correct
21 Correct 5 ms 208 KB Output is correct
22 Correct 4 ms 208 KB Output is correct
23 Correct 3 ms 208 KB Output is correct
24 Correct 3 ms 292 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 208 KB Output is correct
27 Correct 4 ms 208 KB Output is correct
28 Correct 4 ms 208 KB Output is correct
29 Correct 3 ms 292 KB Output is correct
30 Correct 4 ms 316 KB Output is correct
31 Correct 4 ms 312 KB Output is correct
32 Correct 3 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 3 ms 208 KB Output is correct
35 Correct 3 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 2 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 220 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 2 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 5 ms 208 KB Output is correct
21 Correct 5 ms 208 KB Output is correct
22 Correct 4 ms 208 KB Output is correct
23 Correct 3 ms 208 KB Output is correct
24 Correct 3 ms 292 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 208 KB Output is correct
27 Correct 4 ms 208 KB Output is correct
28 Correct 4 ms 208 KB Output is correct
29 Correct 3 ms 292 KB Output is correct
30 Correct 4 ms 316 KB Output is correct
31 Correct 4 ms 312 KB Output is correct
32 Correct 3 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 3 ms 208 KB Output is correct
35 Correct 3 ms 336 KB Output is correct
36 Correct 405 ms 1064 KB Output is correct
37 Correct 1148 ms 1468 KB Output is correct
38 Correct 270 ms 1444 KB Output is correct
39 Correct 653 ms 1460 KB Output is correct
40 Correct 222 ms 1468 KB Output is correct
41 Execution timed out 4051 ms 1460 KB Time limit exceeded
42 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4097 ms 1448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4009 ms 548 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 2 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 220 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 2 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 5 ms 208 KB Output is correct
21 Correct 5 ms 208 KB Output is correct
22 Correct 4 ms 208 KB Output is correct
23 Correct 3 ms 208 KB Output is correct
24 Correct 3 ms 292 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 4 ms 208 KB Output is correct
27 Correct 4 ms 208 KB Output is correct
28 Correct 4 ms 208 KB Output is correct
29 Correct 3 ms 292 KB Output is correct
30 Correct 4 ms 316 KB Output is correct
31 Correct 4 ms 312 KB Output is correct
32 Correct 3 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 3 ms 208 KB Output is correct
35 Correct 3 ms 336 KB Output is correct
36 Correct 405 ms 1064 KB Output is correct
37 Correct 1148 ms 1468 KB Output is correct
38 Correct 270 ms 1444 KB Output is correct
39 Correct 653 ms 1460 KB Output is correct
40 Correct 222 ms 1468 KB Output is correct
41 Execution timed out 4051 ms 1460 KB Time limit exceeded
42 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4051 ms 996 KB Time limit exceeded
2 Halted 0 ms 0 KB -