211072026-01-12 11:49:59ProgramozoRokaKéséscpp17Accepted 50/50143ms2104 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> b(n);
    for(int i=0; i<n; ++i)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b.begin(),b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    int m=b.size();
    bool hasz[m]= {0};
    int i=n-1;
    while(m>0)
    {
        auto it = lower_bound(b.begin(), b.end(), a[i]);
        int index= distance(b.begin(), it);
        if(hasz[index]==0)
        {
            --m;
            hasz[index]=1;
        }
        --i;
    }
    cout<<i+2;
    return 0;
}

SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/010ms564 KiB
3Accepted5/51ms316 KiB
4Accepted5/51ms324 KiB
5Accepted5/563ms1980 KiB
6Accepted5/563ms1976 KiB
7Accepted4/4123ms1984 KiB
8Accepted4/4120ms1988 KiB
9Accepted4/4114ms1844 KiB
10Accepted4/4108ms2064 KiB
11Accepted4/4104ms1976 KiB
12Accepted2/2142ms1844 KiB
13Accepted2/2143ms2104 KiB
14Accepted1/1143ms2100 KiB
15Accepted1/1143ms2100 KiB
16Accepted1/1136ms1988 KiB
17Accepted1/1128ms1844 KiB
18Accepted1/1119ms1844 KiB
19Accepted1/1112ms1844 KiB