比赛 26暑假集训模拟赛2 评测结果 AAAAAAWWWWWWWWWWWWWW
题目名称 OohMoo Milk 最终得分 30
用户昵称 rzzakioi 运行时间 0.145 s
代码语言 C++ 内存使用 3.77 MiB
提交时间 2026-07-02 11:58:14
显示代码纯文本
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,d,a,b,m[100005];
bool cmp(int x,int y){return x>y;}
const int mod=1e9+7;
signed main(){
    freopen("Milk.in","r",stdin);
    freopen("Milk.out","w",stdout);
    scanf("%lld%lld%lld%lld",&n,&d,&a,&b);
    if(n<=1000&&d<=1000){
        for(int i=1;i<=n;i++){
            scanf("%lld",&m[i]);
        }
        while(d--){
            sort(m+1,m+n+1,cmp);
            for(int i=b+1;i<=a;i++){
                m[i]++;
            }
        }
        int ans=0;
        for(int i=1;i<=n;i++){
            ans+=m[i]*m[i];
            ans%=mod;
        }
        cout<<ans<<'\n';
    }
    else cout<<"10";
    return 0;
}