思路 请大家都去看王天懿的贪心问题选讲ppt 代码 //#pragma GCC optimize("Ofast", "inline", "-ffast-math") //#pragma GCC target("avx,sse2,sse3,sse4,mmx") #include<bits/stdc++.h> #define inf 0x3f3f3f3f #define int long long using namespace std; const int N=2e6+7; const int mod=1e9+7; int n,m,ans=0,val[N],a[N]; vector...