Submission #1135485

#TimeUsernameProblemLanguageResultExecution timeMemory
1135485PekibanRadio Towers (IOI22_towers)C++20
0 / 100
4067 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, 0); dp[L] = 1; for (int i = L; i <= R; ++i) { int j = i; for (; j <= R; ++j) { if (a[j] >= a[i] + D) break; } int jj = j; for (; jj <= R; ++jj) { if (a[jj] <= a[j] - D) break; } if (jj <= R) dp[jj] = max(dp[jj], dp[i] + 1); if (i) 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...