92652024-02-19 15:32:35KristófBájital (80 pont)cpp17Time limit exceeded 28/80300ms18148 KiB
#include <iostream>
#include <vector>
#include <bits/stdc++.h>



using namespace std;

int main()
{
    int n;
    cin>>n;
    int x;
    cin>>x;
    int m;
    vector <int> menny;
    for(int i=0;i<n;i++){
        cin>>m;
        menny.push_back(m);
    }
    int meg=0;
    int i=0;
    sort(menny.begin(),menny.end(),greater<int>());
    while(menny.front()>=x)
    {
        while(menny.front()>=x){
            if(menny.back()==0){
                menny.pop_back();
            }
            menny.back()--;
            menny.front()-=x;
            meg++;
        }
        sort(menny.begin(),menny.end(),greater<int>());



    }

    cout<<meg;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base28/80
1Accepted0/03ms1812 KiB
2Accepted0/03ms2012 KiB
3Accepted2/237ms2224 KiB
4Accepted2/232ms2372 KiB
5Accepted2/28ms2552 KiB
6Accepted2/241ms2940 KiB
7Accepted4/485ms2668 KiB
8Time limit exceeded0/4254ms2736 KiB
9Time limit exceeded0/2268ms3184 KiB
10Time limit exceeded0/2261ms3920 KiB
11Time limit exceeded0/2261ms4716 KiB
12Time limit exceeded0/2252ms5664 KiB
13Time limit exceeded0/2277ms6600 KiB
14Time limit exceeded0/2256ms7272 KiB
15Time limit exceeded0/2280ms8080 KiB
16Time limit exceeded0/2252ms8640 KiB
17Time limit exceeded0/2252ms9316 KiB
18Time limit exceeded0/2252ms9992 KiB
19Time limit exceeded0/2264ms10740 KiB
20Time limit exceeded0/2264ms11600 KiB
21Time limit exceeded0/2257ms12380 KiB
22Time limit exceeded0/2277ms13028 KiB
23Accepted4/43ms13088 KiB
24Accepted4/43ms13092 KiB
25Accepted4/43ms13096 KiB
26Accepted4/428ms14484 KiB
27Time limit exceeded0/4300ms14140 KiB
28Time limit exceeded0/4261ms14628 KiB
29Time limit exceeded0/4256ms15424 KiB
30Time limit exceeded0/2277ms16108 KiB
31Time limit exceeded0/2264ms16780 KiB
32Time limit exceeded0/2264ms17460 KiB
33Time limit exceeded0/2273ms18148 KiB