60272023-10-25 16:41:53Tina0731Késéscpp14Accepted 50/50131ms31108 KiB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

bool Rendez(pair<int, int> a, pair<int, int> b)
{
    if(a.first>b.first || (a.first==b.first && a.second<b.second))
        return false;
    else
        return true;


}

int main()
{
    int n;
    cin>>n;
    vector<pair<int,int>> t(n);
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        t.at(i).first=x;
        t.at(i).second=i+1;
    }

    sort(t.begin(),t.end(),Rendez);

    //for(int i=0;i<n;i++)
      //  cout<<t.at(i).second<<". "<<t.at(i).first<<endl;

    int utolso=n*n;
    for(int i=1;i<n;i++)
        if(t.at(i).first!=t.at(i-1).first)
        {
            if(t.at(i).second<utolso)
                utolso=t.at(i).second;
        }
    cout<<utolso;


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1812 KiB
2Accepted0/012ms2364 KiB
3Accepted5/53ms2648 KiB
4Accepted5/53ms2700 KiB
5Accepted5/587ms6448 KiB
6Accepted5/587ms7288 KiB
7Accepted4/4107ms8776 KiB
8Accepted4/4105ms10144 KiB
9Accepted4/4107ms11520 KiB
10Accepted4/4107ms13160 KiB
11Accepted4/4108ms14288 KiB
12Accepted2/2131ms16168 KiB
13Accepted2/2128ms18136 KiB
14Accepted1/1128ms20348 KiB
15Accepted1/1128ms22280 KiB
16Accepted1/1129ms24492 KiB
17Accepted1/1128ms26676 KiB
18Accepted1/1130ms28928 KiB
19Accepted1/1131ms31108 KiB