Submission #1067252

# Submission time Handle Problem Language Result Execution time Memory
1067252 2024-08-20T13:29:07 Z n1k Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 3800 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])});
}

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 4056 ms 3800 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 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '292', found: '271'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '292', found: '271'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4027 ms 1364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4078 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 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '292', found: '271'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4056 ms 3800 KB Time limit exceeded
2 Halted 0 ms 0 KB -