222112026-01-14 17:53:26algoproBájital (80 pont)cpp17Wrong answer 16/80300ms1016 KiB
// UUID: 4fd3f8d4-b19b-4553-b9e6-d5e3eae7ecc0
#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 first=0, last=n-1;
    int count = 0;
    while (first<=last&&1<=v[first]&&x<=v[last]) {
        v[first]-=1;
        if (v[first]<=0) first++;
        v[last]-=x;
        if (v[last]-x<=0) last--;
        count++;
        
    }
    cout << count;
}
SubtaskSumTestVerdictTimeMemory
base16/80
1Accepted0/02ms316 KiB
2Wrong answer0/03ms316 KiB
3Wrong answer0/294ms316 KiB
4Wrong answer0/279ms508 KiB
5Wrong answer0/214ms316 KiB
6Wrong answer0/294ms424 KiB
7Wrong answer0/4187ms316 KiB
8Time limit exceeded0/4291ms508 KiB
9Time limit exceeded0/2298ms820 KiB
10Time limit exceeded0/2300ms820 KiB
11Time limit exceeded0/2277ms820 KiB
12Time limit exceeded0/2289ms820 KiB
13Time limit exceeded0/2300ms820 KiB
14Time limit exceeded0/2300ms820 KiB
15Time limit exceeded0/2287ms820 KiB
16Time limit exceeded0/2286ms1016 KiB
17Time limit exceeded0/2300ms820 KiB
18Time limit exceeded0/2300ms820 KiB
19Time limit exceeded0/2291ms820 KiB
20Time limit exceeded0/2279ms1004 KiB
21Time limit exceeded0/2300ms820 KiB
22Time limit exceeded0/2300ms820 KiB
23Accepted4/41ms316 KiB
24Accepted4/41ms316 KiB
25Accepted4/41ms316 KiB
26Accepted4/414ms820 KiB
27Time limit exceeded0/4300ms788 KiB
28Time limit exceeded0/4280ms820 KiB
29Time limit exceeded0/4300ms820 KiB
30Wrong answer0/2167ms820 KiB
31Wrong answer0/252ms820 KiB
32Time limit exceeded0/2287ms820 KiB
33Time limit exceeded0/2280ms1012 KiB