Submission #1056212

# Submission time Handle Problem Language Result Execution time Memory
1056212 2024-08-13T08:16:41 Z parsadox2 Radio Towers (IOI22_towers) C++17
11 / 100
7 ms 2136 KB
#include <bits/stdc++.h>
#include "towers.h"

using namespace std;

const int N = 2e3 + 10 , inf = 1e9;

int n , a[N];

void init(int nn , vector <int> vec)
{
	n = nn;
	for(int i = 0 ; i < n ; i++)
		a[i] = vec[i];
}

int Solve(int l , int r , int d , int val)
{
	if(l > r)
		return 0;
	int mn = inf;
	int pos_mx = l;
	for(int i = l ; i <= r ; i++)
	{
		mn = min(mn , a[i]);
		if(a[i] > a[pos_mx])
			pos_mx = i;
	}
	if(mn > val)
		return 0;
	int res = max(1 , Solve(l , pos_mx - 1 , d , a[pos_mx] - d) + Solve(pos_mx + 1 , r , d , a[pos_mx] - d));
	return res;
}


int max_towers(int l , int r , int d)
{
	return Solve(l , r , d , inf);
}
# Verdict Execution time Memory Grader output
1 Runtime error 5 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 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 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 1 ms 344 KB Output is correct
9 Correct 0 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 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 436 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 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 5 ms 344 KB Output is correct
24 Correct 4 ms 480 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 1 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 4 ms 344 KB Output is correct
33 Correct 4 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 4 ms 504 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 0 ms 344 KB Output is correct
4 Correct 0 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 1 ms 344 KB Output is correct
9 Correct 0 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 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 436 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 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 5 ms 344 KB Output is correct
24 Correct 4 ms 480 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 1 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 4 ms 344 KB Output is correct
33 Correct 4 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 4 ms 504 KB Output is correct
36 Runtime error 5 ms 1368 KB Execution killed with signal 11
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 2136 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 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 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 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 1 ms 344 KB Output is correct
9 Correct 0 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 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 436 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 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 5 ms 344 KB Output is correct
24 Correct 4 ms 480 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 1 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 4 ms 344 KB Output is correct
33 Correct 4 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 4 ms 504 KB Output is correct
36 Runtime error 5 ms 1368 KB Execution killed with signal 11
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 1368 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -