126552024-12-27 15:28:22ffteklaAranycipők (45)cpp17Accepted 45/452ms508 KiB
#include<iostream>
#include<climits>

using namespace std;

void beolvas(int& n, int* golok) {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> golok[i];
    }
}

void gyoztesekKeresese(int n, int* golok, int& gyoztsekSzama, int* gyoztesek,int& maxGol) {
    for (int i = 0; i <= n; i++)
{
        if (maxGol < golok[i])
{
            maxGol = golok[i];
            gyoztesek[0] = i+1;
            gyoztsekSzama = 1;
        }
        else if (maxGol == golok[i])
{
            gyoztesek[gyoztsekSzama] = i + 1;
            gyoztsekSzama++;
        }
    }
}

void kiir(int gyoztesekSzama, int* gyoztesek,int maxGol) {
    cout << maxGol<<endl<<gyoztesekSzama<<endl;
    for(int i = 0; i < gyoztesekSzama; i++) {
        cout << gyoztesek[i]<<endl;
    }
}
int main() {

    int n, maxGol = 0;
    int* golok = new int[1000] {0};
    int gyoztesekSzama = 0;
    int* gyoztesek = new int[1000];
    beolvas(n,golok);
    gyoztesekKeresese(n, golok, gyoztesekSzama, gyoztesek,maxGol);
    kiir(gyoztesekSzama, gyoztesek, maxGol);
    return 0;
}

SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/02ms416 KiB
2Accepted0/01ms320 KiB
3Accepted3/31ms508 KiB
4Accepted3/31ms320 KiB
5Accepted3/31ms320 KiB
6Accepted3/31ms320 KiB
7Accepted3/31ms320 KiB
8Accepted3/31ms320 KiB
9Accepted3/31ms320 KiB
10Accepted3/32ms320 KiB
11Accepted3/31ms320 KiB
12Accepted3/31ms320 KiB
13Accepted3/31ms320 KiB
14Accepted3/32ms320 KiB
15Accepted3/32ms320 KiB
16Accepted3/31ms320 KiB
17Accepted3/32ms320 KiB