Submission #1067248

# Submission time Handle Problem Language Result Execution time Memory
1067248 2024-08-20T13:26:10 Z n1k Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 3784 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, int 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, 1e9);
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4066 ms 3784 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 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 4093 ms 1368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4089 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 4066 ms 3784 KB Time limit exceeded
2 Halted 0 ms 0 KB -