56072023-08-03 00:48:07lazingergoBájital (80 pont)cpp17Wrong answer 4/80277ms5480 KiB
#include <iostream>
#include <fstream>
#include <algorithm>
#include <climits>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <stack>
#include <queue>

#define ll long long
#define ull unsigned long lon
#define vi vector<int>

using namespace std;

int minh(int* x, int n, int m)
{
    int minelem=x[0];
    int minpoz=-1;
    int minm=INT_MAX;
    int minmpoz=-1;
    for (int i=1; i<n; i++)
    {
        if(x[i]<minelem)
        {
            minelem=x[i];
            minpoz=i;
            if(x[i]<m)
            {
                minm=x[i];
                minmpoz=i;
            }
        }
    }
    
    if(minm!=INT_MAX)
    {
        return minmpoz;
    }
    else
    {
        return minpoz;
    }
}

void solve()
{
    int n,m;
    cin>>n>>m;
   
    int* x=new int[n];

    for(int i=0; i<n;i++)
    {
        int a;
        cin>>a;
        x[i]=a;
    }
    
    int nr=0;
    int i=0;
    while(i<n)
    {
        x[minh(x,n,m)]--;
        if(x[i]>=m)
        {
            nr++;
            x[i]-=m;
        }
        else
        {
            i++;
        }
    }
    
    cout<<nr<<endl;


}

int main()
{
    

  //  while(t--)
    {
        solve();
    }
}
SubtaskSumTestVerdictTimeMemory
base4/80
1Accepted0/03ms1872 KiB
2Wrong answer0/097ms2276 KiB
3Time limit exceeded0/2273ms2400 KiB
4Time limit exceeded0/2248ms2532 KiB
5Time limit exceeded0/2240ms2772 KiB
6Time limit exceeded0/2268ms2888 KiB
7Time limit exceeded0/4273ms2972 KiB
8Time limit exceeded0/4277ms3148 KiB
9Time limit exceeded0/2273ms2944 KiB
10Time limit exceeded0/2232ms3252 KiB
11Time limit exceeded0/2252ms3360 KiB
12Time limit exceeded0/2277ms3436 KiB
13Time limit exceeded0/2273ms3372 KiB
14Time limit exceeded0/2277ms3408 KiB
15Time limit exceeded0/2261ms3536 KiB
16Time limit exceeded0/2277ms3832 KiB
17Time limit exceeded0/2238ms3832 KiB
18Time limit exceeded0/2266ms3932 KiB
19Time limit exceeded0/2257ms3756 KiB
20Time limit exceeded0/2252ms3748 KiB
21Time limit exceeded0/2256ms3628 KiB
22Time limit exceeded0/2273ms3796 KiB
23Wrong answer0/43ms4300 KiB
24Accepted4/43ms4516 KiB
25Wrong answer0/42ms4600 KiB
26Time limit exceeded0/4254ms4092 KiB
27Time limit exceeded0/4273ms4204 KiB
28Time limit exceeded0/4277ms5480 KiB
29Time limit exceeded0/4248ms4292 KiB
30Time limit exceeded0/2264ms4124 KiB
31Time limit exceeded0/2248ms4244 KiB
32Time limit exceeded0/2264ms4220 KiB
33Time limit exceeded0/2248ms4340 KiB