75852024-01-09 20:44:52csdavidKéséscpp17Accepted 50/50126ms6444 KiB
#include <iostream>
#include <algorithm>
using namespace std;

struct evszam{
    int ido;
    int szam;
};
bool alma(evszam x123, evszam y123){
    if(x123.ido<y123.ido){
        return 1;
    }
    else if(x123.ido==y123.ido&&x123.szam<y123.szam){
        return 1;
    }
    else
    {
        return 0;
    }

}


int main()
{
    int n, e, f;
    cin >> n;
    evszam a[n];
    for(int i = 0; i<n; i++){
        cin >> a[i].ido;
        a[i].szam=i+1;
    }
    sort(a, a+n, alma);
    /*for(int i=0; i<n; i++){
        cout << a[i].szam << " " << a[i].ido << endl;
    }*/

    e = a[n-1].szam;
    n--;
    for(n; n>=0; n--){
        if(a[n+1].ido!=a[n].ido&&e>a[n].szam){
            e = a[n].szam;
        }
    }
    cout << e;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1748 KiB
2Accepted0/010ms2192 KiB
3Accepted5/53ms2132 KiB
4Accepted5/53ms2320 KiB
5Accepted5/581ms5496 KiB
6Accepted5/581ms5644 KiB
7Accepted4/4101ms5728 KiB
8Accepted4/4101ms6044 KiB
9Accepted4/4101ms6040 KiB
10Accepted4/4101ms6424 KiB
11Accepted4/4100ms6196 KiB
12Accepted2/2122ms6196 KiB
13Accepted2/2120ms6288 KiB
14Accepted1/1119ms6292 KiB
15Accepted1/1119ms6208 KiB
16Accepted1/1120ms6444 KiB
17Accepted1/1123ms6188 KiB
18Accepted1/1126ms6088 KiB
19Accepted1/1123ms6280 KiB