Submission #1067257

# Submission time Handle Problem Language Result Execution time Memory
1067257 2024-08-20T13:32:26 Z n1k Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 2344 KB
#include "towers.h"
#include <bits/stdc++.h>

using namespace std;

int n;
vector<int> h;

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

int find(int l, int r, int d, long long minh){
	//cerr<<l<<" "<<r<<endl;
	if(l>r) return 0;
	array<int, 2> mx = {0};
	for(int i=l; i<=r; i++){
		mx = max(mx, {h[i], i});
	}

	return max({
		int(mx[0]+d<=minh), 
		find(l, mx[1]-1, d, mx[0]) + find(mx[1] + 1, r, d, mx[0]),
		find(l, mx[1]-1, d, minh),
		find(mx[1] + 1, r, d, minh)
	});
}

int max_towers(int L, int R, int D) {
	return find(L, R, D, 1e18);
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4030 ms 2344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 130 ms 344 KB Output is correct
3 Correct 129 ms 344 KB Output is correct
4 Correct 759 ms 428 KB Output is correct
5 Correct 165 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 37 ms 344 KB Output is correct
8 Execution timed out 4100 ms 344 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 130 ms 344 KB Output is correct
3 Correct 129 ms 344 KB Output is correct
4 Correct 759 ms 428 KB Output is correct
5 Correct 165 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 37 ms 344 KB Output is correct
8 Execution timed out 4100 ms 344 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4030 ms 1368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4065 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 130 ms 344 KB Output is correct
3 Correct 129 ms 344 KB Output is correct
4 Correct 759 ms 428 KB Output is correct
5 Correct 165 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 37 ms 344 KB Output is correct
8 Execution timed out 4100 ms 344 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4030 ms 2344 KB Time limit exceeded
2 Halted 0 ms 0 KB -