Submission #64049872


Source Code Expand

#include <bits/stdc++.h>
#define ll long long
using namespace std;

unordered_map<int, int> cnt, come;

int ans(-1);

int n;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin>>n;
    for(int i(1); i<=n; i++) {
        int x;
        cin>>x;
        cnt[x]++;
        come[x]=i;
    }
    for(auto i : cnt) {
        if(i.second==1) ans=max(ans, i.first);
    }
    if(ans==-1) cout<<-1;
    else cout<<come[ans];
    return 0;
}

Submission Info

Submission Time
Task C - Uniqueness
User c_legg
Language C++ 20 (gcc 12.2)
Score 300
Code Size 477 Byte
Status AC
Exec Time 106 ms
Memory 27364 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 28
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All hand_01.txt, hand_02.txt, hand_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
hand_01.txt AC 1 ms 3376 KiB
hand_02.txt AC 1 ms 3416 KiB
hand_03.txt AC 1 ms 3468 KiB
random_01.txt AC 106 ms 27364 KiB
random_02.txt AC 35 ms 13044 KiB
random_03.txt AC 92 ms 26648 KiB
random_04.txt AC 70 ms 21828 KiB
random_05.txt AC 94 ms 27240 KiB
random_06.txt AC 58 ms 11960 KiB
random_07.txt AC 40 ms 8976 KiB
random_08.txt AC 41 ms 9296 KiB
random_09.txt AC 18 ms 3480 KiB
random_10.txt AC 62 ms 15204 KiB
random_11.txt AC 63 ms 15204 KiB
random_12.txt AC 53 ms 15140 KiB
random_13.txt AC 52 ms 15140 KiB
random_14.txt AC 52 ms 15184 KiB
random_15.txt AC 53 ms 15144 KiB
random_16.txt AC 19 ms 7716 KiB
random_17.txt AC 4 ms 4248 KiB
random_18.txt AC 48 ms 13644 KiB
random_19.txt AC 39 ms 11876 KiB
random_20.txt AC 26 ms 9004 KiB
random_21.txt AC 1 ms 3608 KiB
random_22.txt AC 39 ms 11720 KiB
random_23.txt AC 17 ms 7336 KiB
sample_01.txt AC 1 ms 3460 KiB
sample_02.txt AC 1 ms 3516 KiB