7102021-11-18 20:16:06Valaki2Késéscpp14Accepted 50/50395ms35552 KiB
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> v(1 + n, 0);
    set<int> s;
    for(int i = 1; i <= n; i++) {
        cin >> v[i];
        s.insert(v[i]);
    }
    int diff_cnt = s.size();
    s.clear();
    for(int i = n; i >= 1; i--) {
        s.insert(v[i]);
        if(diff_cnt == int(s.size())) {
            cout << i << "\n";
            return;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1988 KiB
2Accepted0/012ms3108 KiB
3Accepted5/52ms2172 KiB
4Accepted5/52ms2176 KiB
5Accepted5/543ms4272 KiB
6Accepted5/541ms5040 KiB
7Accepted4/4300ms18308 KiB
8Accepted4/4263ms19120 KiB
9Accepted4/4233ms18848 KiB
10Accepted4/4204ms18912 KiB
11Accepted4/4168ms18668 KiB
12Accepted2/2238ms21608 KiB
13Accepted2/2386ms32192 KiB
14Accepted1/1395ms34044 KiB
15Accepted1/1377ms35552 KiB
16Accepted1/1294ms34264 KiB
17Accepted1/1224ms32076 KiB
18Accepted1/186ms26076 KiB
19Accepted1/164ms27528 KiB