# 1月12日

1月12日

vp一场cf div2

Problem - A - Codeforces

Problem - B - Codeforces

Problem - C - Codeforces

Problem - D - Codeforces

D:

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+10;
int a[N];
void solve() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    vector<int> l(n + 2, 0), r(n + 2, 0);
    for (int i = 1; i <= n; i++) {
        l[i] = l[i - 1] + a[i];
    }
    for (int i = n; i >= 1; i--) {
        r[i] = r[i + 1] + a[i];
    }
    int mn = 1e18, mx = -1;
    for (int i = 1; i <= n; i++) {
        mn = min(l[i] / i, mn);
    }
    for (int i = n; i >= 1; i--) mx = max(mx, (r[i] + n - i) / (n - i + 1));
    cout << mx - mn << endl;
}

signed main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int _;
    cin >> _;
    while (_--)
        solve();
    return 0;
}

在kuangbin题单做了两道水题

Wireless Network - POJ 2236 - Virtual Judge

The Suspects - POJ 1611 - Virtual Judge

posted @ 2025-01-12 20:33  _LXYYYY  阅读(13)  评论(0)    收藏  举报