Submission #1135497

#TimeUsernameProblemLanguageResultExecution timeMemory
1135497PekibanRadio Towers (IOI22_towers)C++20
0 / 100
4086 ms1560 KiB
#include "towers.h" #include <bits/stdc++.h> using namespace std; vector<int> a; int n; void init(int N, vector<int> H) { a = H, n = N; } int max_towers(int L, int R, int D) { int dp[n]; fill(dp, dp+n, 1); for (int i = L; i <= R; ++i) { int j = i, mx = 0; for (; j < n; ++j) { mx = max(a[j], mx); if (a[j] <= mx - D && a[i] <= mx - D) break; } if (j <= R) dp[j] = max(dp[j], dp[i] + 1); if (i != L) dp[i] = max(dp[i], dp[i-1]); } return dp[R]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...