数据备份
题意:在数组中选择k个数使得和最小,且不能相邻。
//#pragma GCC optimize(2) //#pragma GCC optimize(3,"Ofast","inline") #include#define int long long #define fi first #define se second #define pii pair #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int inf=2e18+100; const int maxn=2e5+100; int a[maxn],l[maxn],r[maxn]; bool vis[maxn]; priority_queue ,greater >q; signed main() { IOS int n,k; cin>>n>>k; for(int i=1; i<=n; i++) { cin>>a[i]; } for(int i=1; i


![[APIO/CTSC 2007] 数据备份(反悔贪心) [APIO/CTSC 2007] 数据备份(反悔贪心)](http://www.mshxw.com/aiimages/31/291033.png)
