Submission #64061218
Source Code Expand
Copy
#include<bits/stdc++.h>#define ll long long intconst int N = 3e5 + 10;using namespace std;ll a[N];int main(){int n;cin >> n;map<int, int> mp;for(int i = 1; i <= n; i++){cin >> a[i];mp[a[i]] ++;}int ans = -1;int maxk = INT_MIN;for(int i = 1; i <= n; i++){if(mp[a[i]] == 1){
#include<bits/stdc++.h> #define ll long long int const int N = 3e5 + 10; using namespace std; ll a[N]; int main() { int n; cin >> n; map<int, int> mp; for(int i = 1; i <= n; i++) { cin >> a[i]; mp[a[i]] ++; } int ans = -1; int maxk = INT_MIN; for(int i = 1; i <= n; i++) { if(mp[a[i]] == 1) { if(a[i] > maxk) { ans = i; maxk = a[i]; } } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Uniqueness |
User | ZH99 |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 443 Byte |
Status | AC |
Exec Time | 260 ms |
Memory | 19864 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 3460 KB |
hand_02.txt | AC | 1 ms | 3644 KB |
hand_03.txt | AC | 1 ms | 3408 KB |
random_01.txt | AC | 252 ms | 19864 KB |
random_02.txt | AC | 84 ms | 9976 KB |
random_03.txt | AC | 243 ms | 19216 KB |
random_04.txt | AC | 166 ms | 15152 KB |
random_05.txt | AC | 260 ms | 19640 KB |
random_06.txt | AC | 193 ms | 10560 KB |
random_07.txt | AC | 137 ms | 8720 KB |
random_08.txt | AC | 141 ms | 8740 KB |
random_09.txt | AC | 75 ms | 5796 KB |
random_10.txt | AC | 130 ms | 12940 KB |
random_11.txt | AC | 128 ms | 12852 KB |
random_12.txt | AC | 138 ms | 12868 KB |
random_13.txt | AC | 135 ms | 12844 KB |
random_14.txt | AC | 143 ms | 12876 KB |
random_15.txt | AC | 140 ms | 13004 KB |
random_16.txt | AC | 51 ms | 6812 KB |
random_17.txt | AC | 9 ms | 4072 KB |
random_18.txt | AC | 145 ms | 10932 KB |
random_19.txt | AC | 104 ms | 9256 KB |
random_20.txt | AC | 73 ms | 7872 KB |
random_21.txt | AC | 2 ms | 3720 KB |
random_22.txt | AC | 105 ms | 9208 KB |
random_23.txt | AC | 41 ms | 6136 KB |
sample_01.txt | AC | 1 ms | 3496 KB |
sample_02.txt | AC | 1 ms | 3540 KB |