Submission #1074017

# Submission time Handle Problem Language Result Execution time Memory
1074017 2024-08-25T06:30:24 Z Gromp15 Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 2916 KB
#include <bits/stdc++.h>
#include "towers.h"
#define ll long long
#define ar array
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;

template<typename T> bool ckmin(T &a, const T &b ) { return a > b ? a = b, 1 : 0; }
template<typename T> bool ckmax(T &a, const T &b ) { return a < b ? a = b, 1 : 0; }

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

int max_towers(int L, int R, int D) {
	auto solve = [&](auto&& s, int l, int r, int lim) -> int {
		if (l > r) return 0;
		if (l == r) return h[l] <= lim;
		int p = l;
		for (int i = l+1; i <= r; i++) if (h[i] > h[p]) p = i;
		return max(int(h[p] <= lim), s(s, l, p-1, h[p] - D) + s(s, p+1, r, h[p] - D));
	};
	return solve(solve, L, R, 1e9);
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4067 ms 2916 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 1 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 1 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 4081 ms 1368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4088 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 1 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 4067 ms 2916 KB Time limit exceeded
2 Halted 0 ms 0 KB -