92662024-02-19 15:46:57KristófBájital (80 pont)cpp17Wrong answer 8/80287ms5276 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;
    int ism=0;
    sort(menny.begin(),menny.end(),greater<int>());
    while(menny.front()>=x)
    {
        ism=menny.front()/x;
        menny.front()=menny.front()%x;
            for(int m=0;m<ism;m++)
            {
                if(menny.back()==0)
                {
                menny.pop_back();
                }
                menny.back()--;
                meg++;
            }
        sort(menny.begin(),menny.end(),greater<int>());
    }






    cout<<meg;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/80
1Accepted0/03ms1808 KiB
2Wrong answer0/03ms2012 KiB
3Runtime error0/218ms2600 KiB
4Runtime error0/216ms2840 KiB
5Runtime error0/26ms2916 KiB
6Runtime error0/220ms3036 KiB
7Runtime error0/445ms3084 KiB
8Runtime error0/4131ms3436 KiB
9Time limit exceeded0/2286ms3452 KiB
10Time limit exceeded0/2264ms3500 KiB
11Time limit exceeded0/2254ms3540 KiB
12Time limit exceeded0/2250ms3560 KiB
13Time limit exceeded0/2270ms3648 KiB
14Time limit exceeded0/2264ms3824 KiB
15Time limit exceeded0/2256ms4104 KiB
16Time limit exceeded0/2256ms4032 KiB
17Time limit exceeded0/2264ms4156 KiB
18Time limit exceeded0/2256ms3952 KiB
19Time limit exceeded0/2264ms4100 KiB
20Time limit exceeded0/2252ms3948 KiB
21Time limit exceeded0/2277ms4032 KiB
22Time limit exceeded0/2264ms4192 KiB
23Runtime error0/43ms4312 KiB
24Accepted4/43ms4244 KiB
25Runtime error0/43ms4124 KiB
26Accepted4/428ms5276 KiB
27Time limit exceeded0/4287ms4072 KiB
28Time limit exceeded0/4256ms4208 KiB
29Time limit exceeded0/4264ms4164 KiB
30Time limit exceeded0/2241ms4164 KiB
31Time limit exceeded0/2248ms4224 KiB
32Time limit exceeded0/2257ms4484 KiB
33Time limit exceeded0/2273ms4660 KiB