46422023-03-30 13:55:41KristófProgramtermék verseny (70 pont)cpp11Accepted 70/7037ms5016 KiB
#include <iostream>

using namespace std;

int main()
{
    int N;
    int bs;
    cin>>N;
    cin>>bs;

    int arany = N/12;
    int ezust = N/4;
    int bronz =N/2;

    int pontok[N+1];
    for(int i=1; i<=N; i++){
        cin>>pontok[i];
    }
    int bendeguz = pontok[bs];
    int db = 0; //bendegúznál jobbak
    int a=0;
    int e=0;
    int b=0;
    bool ae =true;
    bool ee=true;
    bool be=true;
    for(int i=1; i<=N;i++){

        if(pontok[i]>bendeguz)
            db++;
        if(db == arany && i>bs &&ae==true){
            a=i-1;
            ae=false;
        }
        else if(db >=arany && i<bs && ae==true){
            a=0;
            ae=false;
        }
       else  if(db == ezust && i>bs &&ee==true){
            e=i-1;
            ee=false;
        }
        else if(db >=ezust && i<bs && ee==true){
            e=0;
            ee=false;
        }
else if(db == bronz && i>bs &&be==true){
            b=i-1;
            be=false;
        }
        else if(db >=bronz && i<bs && be==true){
            b=0;
            be=false;
        }
    }


if(ae==true){
    cout<<N<<endl;
    cout<<0<<endl;
    cout<<0<<endl;
}
else if(ee==true){
       cout<<a<<endl;
cout<<N<<endl;
cout<<0<<endl;
        }
   else if(be==true){
    cout<<a<<endl;
    cout<<e<<endl;
    cout<<N<<endl;
   }
   else{
    cout<<a<<endl;
    cout<<e<<endl;
    cout<<b<<endl;
   }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/03ms1756 KiB
2Accepted0/03ms1988 KiB
3Accepted0/037ms2848 KiB
4Accepted3/33ms2316 KiB
5Accepted3/33ms2680 KiB
6Accepted3/32ms2620 KiB
7Accepted3/33ms2752 KiB
8Accepted3/33ms2832 KiB
9Accepted3/33ms2836 KiB
10Accepted3/33ms3040 KiB
11Accepted3/33ms3256 KiB
12Accepted3/33ms3372 KiB
13Accepted3/33ms3496 KiB
14Accepted4/44ms3568 KiB
15Accepted4/419ms4000 KiB
16Accepted4/426ms3844 KiB
17Accepted4/427ms4140 KiB
18Accepted4/46ms3852 KiB
19Accepted4/48ms3980 KiB
20Accepted4/412ms4148 KiB
21Accepted4/437ms4936 KiB
22Accepted4/437ms5016 KiB
23Accepted4/432ms4724 KiB