【滑动窗口】codeforces 1290 A. Mind Control
1.前后缀分解2.【前缀和+开区间二分】codeforces 1187 B. Letters Shop3.【字符串哈希+二分】AcWing 3508. 最长公共子串4.【二分+前缀和+后缀和】codeforces 2026 D. Sums of Segments
5.【滑动窗口】codeforces 1290 A. Mind Control
6.【三分】AcWing 3666. 士兵排阵7.【带权前缀和】codeforces 2044 H. Hard Demon Problem8.【区间合并+贡献法】codeforces 1789 C. Serval and Toxel's Arrays9.【离线+单调栈】AtCoder ABC379 F. Buildings 210.【前后缀分解】AtCoder ABC393 D.Swap to Gather题意
第一行输入一个正整数
第一行输入三个正整数
总的有
题解
若控制第
不妨暴力枚举删除前
参考代码
#include<bits/stdc++.h> using namespace std; constexpr int N = 3507; int T, n, m, k; int a[N]; void solve() { cin >> n >> m >> k; int ans = 1, w = min(m - 1, k); m -= w + 1; for (int i = 0; i < n; ++ i) cin >> a[i]; for (int i = 0; i <= w; ++ i) { int left = i, right = n - w + i - 1; int res = 1e9; for (int j = 0; j <= m; ++ j) res = min(res, max(a[left + j], a[right - m + j])); ans = max(ans, res); } cout << ans << '\n'; } int main() { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); cin >> T; while (T --) { solve(); } return 0; }
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 【.NET】调用本地 Deepseek 模型