三亩地 三亩地SAN MU DI · CODE DIARY
ARTICLE DETAIL

日记详情

真实记录编程学习的某一天,欢迎挑你感兴趣的翻一翻。

中国空间站距离地面多少公里建筑工程包括哪些项目

中国空间站距离地面多少公里建筑工程包括哪些项目 中国空间站距离地面多少公里,建筑工程包括哪些项目,最优秀的wordpress主题,容易被百度收录的网站[NOISG 2018 Finals] Safety Slope Trick。和 NarrowRectangles 这个题一样。AC Code // Written by Mi2uk1 // Try Harder.#includebits/stdc++.h using namespace std; #define ll long long #define i28 _…[NOISG 2018 Finals] Safety Slope Trick。和 NarrowRectangles 这个题一样。AC Code // Written by Mi2uk1 // Try Harder.#includebits/stdc++.h using namespace std; #define ll long long #define i28 __int128 #define ull unsigned long long #define pii pairint,int #define pll pairlong long,long long #define fir first #define INF (1e9) #define sec second #define pb push_back #define eb emplace_backconst int N=2e5+9,M=5e6+9; const int MOD=1e9+7; const double eps=1e-14; inline void chkmax(int x,int y){x=xy?y:x;} inline void chkmin(int x,int y){x=xy?x:y;} inline void chkmax(ll x,ll y){x=xy?y:x;} inline void chkmin(ll x,ll y){x=xy?x:y;} inline int lowbit(int x){return x(-x);} int qpow(int a,int b,int p){int ret=1;while(b){if(b1) ret=1ll*ret*a%p;a=1ll*a*a%p;b=1;}return ret; }#define int long long int n,H,a[N],tagl,tagr,ans; priority_queueint sl; priority_queueint,vectorint,greaterint sr; void Mian(){cinnH;for(int i=1;i=n;++i) cina[i];sl.push(a[1]); sr.push(a[1]);tagl=tagr=ans=0;for(int i=2;i=n;++i){tagl-=H,tagr+=H;int L=sl.top()+tagl,R=sr.top()+tagr;if(a[i]L){ans+=(L-a[i]);sl.pop();sl.push(a[i]-tagl); sl.push(a[i]-tagl);sr.push(L-tagr); }else if(a[i]R){ans+=(a[i]-R);sr.pop();sr.push(a[i]-tagr); sr.push(a[i]-tagr);sl.push(R-tagl);}else{sl.push(a[i]-tagl); sr.push(a[i]-tagr); }} coutans; } void Mianclr(){} signed main(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); //freopen("ftc1.in","r",stdin);//freopen("r.out","w",stdout);int c,T=1; //cinT;while(T--){Mianclr();Mian();} }
← 返回列表