211082026-01-12 11:50:45ProgramozoRokaKéséscpp17Accepted 50/5085ms2100 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    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;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/07ms580 KiB
3Accepted5/51ms316 KiB
4Accepted5/51ms316 KiB
5Accepted5/535ms1844 KiB
6Accepted5/534ms1848 KiB
7Accepted4/479ms2004 KiB
8Accepted4/476ms2008 KiB
9Accepted4/471ms2100 KiB
10Accepted4/465ms1844 KiB
11Accepted4/461ms2008 KiB
12Accepted2/282ms1848 KiB
13Accepted2/285ms2100 KiB
14Accepted1/182ms2100 KiB
15Accepted1/182ms2008 KiB
16Accepted1/175ms2008 KiB
17Accepted1/165ms2096 KiB
18Accepted1/159ms1904 KiB
19Accepted1/152ms1844 KiB