71342023-12-31 12:06:53KristófHús sütés (75 pont)cpp17Wrong answer 33/7539ms4932 KiB
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int volgy[n];
    for(int i=0;i<n;i++){
        cin>>volgy[i];
    }

    int nagy=0;
    int nagysz=0;
    int kicsi=10000000;
    int ered=0;

    for(int i=0;i<n;i++){
        if(nagy<volgy[i]){
            nagy=volgy[i];
        }
    }
    for(int i=0;i<n;i++){
        if(volgy[i]<kicsi){
            kicsi=volgy[i];
           
        }
         if(volgy[i]==nagy){
                nagysz++;

            }
    }

    int ans=kicsi+n-1;

    if(nagysz==1){
        cout<<nagy;
    }
    else{
        cout<<ans;
    }


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base33/75
1Accepted0/03ms1880 KiB
2Accepted0/03ms2088 KiB
3Accepted0/019ms2784 KiB
4Accepted3/33ms2512 KiB
5Wrong answer0/33ms2752 KiB
6Wrong answer0/33ms2808 KiB
7Wrong answer0/33ms3024 KiB
8Wrong answer0/43ms3220 KiB
9Accepted4/43ms3432 KiB
10Wrong answer0/43ms3516 KiB
11Accepted4/43ms3516 KiB
12Wrong answer0/43ms3516 KiB
13Accepted4/437ms4412 KiB
14Wrong answer0/437ms4492 KiB
15Wrong answer0/537ms4488 KiB
16Wrong answer0/537ms4620 KiB
17Wrong answer0/537ms4832 KiB
18Accepted4/437ms4916 KiB
19Accepted4/437ms4916 KiB
20Accepted4/439ms4920 KiB
21Accepted4/426ms4932 KiB
22Wrong answer0/234ms4924 KiB
23Accepted2/219ms4920 KiB