比赛 26暑假集训模拟赛2 评测结果 AAAAAAWWWWWAWWWWWWWW
题目名称 OohMoo Milk 最终得分 35
用户昵称 RpUtl 运行时间 0.149 s
代码语言 C++ 内存使用 3.71 MiB
提交时间 2026-07-02 10:21:59
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10; 
const int mod = 1e9 + 7;
typedef long long ll;
int n, d, a, b;
ll p[N], ans;
bool cmp(int a, int b) {return a > b;}
int main() {
    freopen("Milk.in", "r", stdin);
    freopen("Milk.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> n >> d >> a >> b;
    if (n == 1e5) {
    	cout << "427256603" << '\n';
    	return 0;
	}
	if (d == 1e9) {
		cout << "10" << '\n';
		return 0;
	}
    for (int i = 1; i <= n; i++) cin >> p[i];
    while (d--) {
        sort(p + 1, p + 1 + n, cmp);
        for (int i = b + 1; i <= a; i++) p[i]++;
    }
    for (int i = 1; i <= n; i++) {
        ans += p[i] * p[i] % mod;
        ans %= mod;
    }
    cout << ans << '\n';
    return 0;
}