题意 类似超级钢琴,找最优解用可持久化trie. code: #include<bits/stdc++.h> using namespace std; #define re register typedef long long ll; const int maxn=5*1e5+10; int n,m,tot; int root[maxn],last[maxn*40*2]; int trie[maxn*40][2]; ll ans; ll a[maxn],sum[maxn]; struct no…