#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define y1 shinkle
#define fi first
#define se second
#define bg begin
#define gc getchar
inline int read(){
char ch=gc();
int res=0;bool f=1;
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
return f?res:-res;
}
inline ll readll(){
char ch=gc();
ll res=0;bool f=1;
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
return f?res:-res;
}
inline int readstring(char *s){
int top=0;char ch=gc();
while(isspace(ch))ch=gc();
while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
s[top+1]='\0';return top;
}
template<typename tp>inline void chemx(tp &a,tp b){a=max(a,b);}
template<typename tp>inline void chemn(tp &a,tp b){a=min(a,b);}
cs int L=1e7,N=1000005;
cs ll inf=1e18;
ll sl[N],sv[N],v[N];
vector<ll> Slope,F,P;
signed main(){
// freopen("1.in","r",stdin);
int t=1428133,n=38;
int len=t/n,Ans;
int tot=0;
ll sm=0,slope=0,lst=0;
while(n--){
for(int i=1;i<=len;i++)sl[i]=rand(),sv[i]=rand(),v[i]=rand();
int tt=clock();
for(int i=1;i<=len;i++){
if(sl[i]||sv[i]){
sm+=slope*(v[i]-lst)+sv[i];
slope+=sl[i];
P.emplace_back(v[i]),
F.emplace_back(sm),
Slope.emplace_back(slope);
sl[i]=sv[i]=0;
lst=v[i];
}
}
Ans+=sm*slope;
Ans+=P.back()*F.back()*Slope.back();
tot+=clock()-tt;
}
cerr<<tot<<'\n';
}
//total:25
//total:40
//1:12~13
//2:20~30
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 25.54 ms | 54 MB + 724 KB | Accepted | Score: 100 | 显示更多 |