222172026-01-14 18:02:14algoproBájital (80 pont)cpp17Wrong answer 16/80300ms1016 KiB
// UUID: 9f671234-f1ac-4221-b250-75537f12ab45
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
//#define int long long
//#define INT_MIN LLONG_MIN
//#define INT_MAX LLONG_MAX

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
	int n,x;
    cin >> n >> x;
    vector<int> v(n);
    for (int i=0; i<n; i++) {
        cin >> v[i];
    }
    sort(v.begin(),v.end());
    int l=0, r=n-1;
    int count = 0;
    while (l<=r) {
        if (l==r) {
            if (v[l] >= x+1) count += v[l]/(x+1);
            break;
        }
        if (v[l]<=0 || v[r]<x) break;
        v[l]-=1;
        v[r]-=x;
        if (v[l]<=0) l++;
        if (v[r]<=0) r--;
        count++;
        
    }
    cout << count;
}
SubtaskSumTestVerdictTimeMemory
base16/80
1Wrong answer0/01ms324 KiB
2Wrong answer0/01ms508 KiB
3Wrong answer0/24ms512 KiB
4Wrong answer0/22ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/42ms492 KiB
8Wrong answer0/43ms500 KiB
9Time limit exceeded0/2291ms1012 KiB
10Wrong answer0/232ms820 KiB
11Wrong answer0/226ms604 KiB
12Wrong answer0/225ms820 KiB
13Wrong answer0/224ms820 KiB
14Wrong answer0/226ms820 KiB
15Wrong answer0/224ms820 KiB
16Wrong answer0/224ms820 KiB
17Wrong answer0/224ms820 KiB
18Wrong answer0/224ms820 KiB
19Wrong answer0/224ms820 KiB
20Wrong answer0/224ms820 KiB
21Wrong answer0/224ms820 KiB
22Wrong answer0/224ms824 KiB
23Accepted4/42ms316 KiB
24Accepted4/41ms316 KiB
25Accepted4/41ms316 KiB
26Accepted4/414ms644 KiB
27Wrong answer0/423ms820 KiB
28Wrong answer0/423ms820 KiB
29Wrong answer0/423ms820 KiB
30Wrong answer0/223ms1016 KiB
31Wrong answer0/223ms820 KiB
32Time limit exceeded0/2300ms712 KiB
33Time limit exceeded0/2300ms820 KiB