传送门 单调队列优化dp板子 表示不大想写详细做法,自己看代码吧qwq (懒) 注意细节,不然就会跟我一样WA4次 // luogu-judger-enable-o2 #include<bits/stdc++.h> #define LL long long #define il inline #define re register #define db double #define eps (1e-5) using namespace std; const int N=100000+10; i…
Code: #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define setIO(s) freopen(s".in","r",stdin) #define N 100010 #define ll long long using namespace std; ll n, k, maxn, ans, head = 1,…