Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
36121 zqqq 【S】T2 C++ 运行出错 0 0 MS 256 KB 487 2025-02-07 16:17:01

Tests(0/20):


#include<bits/stdc++.h> using namespace std; const int N=1e4+10; #define ll long long ll n,p[N],tmp[N]; int main(){ freopen("book10.in","r",stdin); freopen("book10.out","w",stdout); ios::sync_with_stdio(0); cin>>n; for(int i=1;i<=n;i++){ cin>>p[i]; } ll ans=0; for(ll len=1;len<=n;len+=2){ for(ll l=1;l+len-1<=n;l++){ ll r=l+len-1; memcpy(tmp,p,N); sort(tmp+l,tmp+r+1); ans+=l*r*tmp[(l+r)/2]; } } cout<<ans<<endl; return 0; }


测评信息: