114312024-09-16 09:06:31RRoliAranycipők (45)cpp17Accepted 45/453ms632 KiB
#include <bits/stdc++.h>
using namespace std;

int n, a[1001], ln, sz;
struct lista{
    int elem;
    lista *kov;
} *elso, *utolso;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    elso = NULL;

    //ifstream f("be.in");
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        ln = max(ln, a[i]);
    }
    for(int i = 1; i <= n; i++) {
        if(a[i] == ln) {
            sz++;
            lista *p;
            p = new lista;
            p->elem = i;
            p->kov = NULL;
            if(elso == NULL) {
                elso = p;
                utolso = elso;
            } else {
                utolso->kov = p;
                utolso = p;
            }
        }
    }

    cout << ln << '\n' << sz << '\n';
    lista *p = elso;
    while(p != NULL) {
        cout << p->elem << '\n';
        p = p->kov;
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base45/45
1Accepted0/03ms360 KiB
2Accepted0/03ms360 KiB
3Accepted3/33ms360 KiB
4Accepted3/33ms632 KiB
5Accepted3/33ms488 KiB
6Accepted3/33ms488 KiB
7Accepted3/33ms488 KiB
8Accepted3/32ms424 KiB
9Accepted3/32ms376 KiB
10Accepted3/33ms360 KiB
11Accepted3/33ms360 KiB
12Accepted3/33ms360 KiB
13Accepted3/33ms376 KiB
14Accepted3/33ms360 KiB
15Accepted3/33ms360 KiB
16Accepted3/33ms360 KiB
17Accepted3/33ms376 KiB