| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 91187 | sh25_shenpy | 龙虎斗 | C++ | 通过 | 32 MS | 1040 KB | 1024 | 2026-06-12 15:14:20 |
#include <bits/stdc++.h> #define max maxx #define min minn #define ll long long using namespace std; ll n,c[100005],m,p1,s1,s2,p2; ll lo,hu; ll max(ll a,ll b) { if(a>b) return a; else return b; } ll min(ll a,ll b) { if(a<b) return a; else return b; } int main() { ll i; cin>>n; for(i=1;i<=n;i++) cin>>c[i]; cin>>m>>p1>>s1>>s2; c[p1]+=s1; for(i=1;i<m;i++) lo+=c[i]*(m-i); for(i=m+1;i<=n;i++) hu+=c[i]*(i-m); if(lo==hu) cout<<m<<endl; else if(lo<hu) { p2=m-(hu-lo)/s2; p2=max(1,p2); p2=min(n,p2); if(p2>1 && (abs(lo+s2*(m-p2+1)-hu)<=abs(hu-lo-s2*(m-p2)))) cout<<p2-1<<endl; else cout<<p2<<endl; } else { p2=m+(lo-hu)/s2; p2=max(1,p2); p2=min(n,p2); if(p2<n && (abs(hu+s2*(p2+1-m)-lo)<abs(hu+s2*(p2-m)-lo))) cout<<p2+1<<endl; else cout<<p2<<endl; } return 0; }