2922021-08-05 00:10:18mraronKéséscpp14Accepted 50/50199ms35560 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")
 
#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (int) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2
#define v(x) (int)(x - 'a')
 
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;
 
template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;
 
const ll infll = numeric_limits <ll>::max() >> 1;
const int inf = numeric_limits <int>::max() >> 1;
const int N = 2e5 + 1;
int n;
int arr[N];

map <int, int> cnt;

void input() 
{
     cin >> n;
     for (int i = 1; i <= n; ++i) {
          cin >> arr[i];
          cnt[arr[i]]++;
     }
}

void solve()
{
     for (int i = 1; i <= n; ++i) {
          if (!--cnt[arr[i]]) {
               cout << i << "\n";
               return;
          }
     }
}

int main() 
{
     ios_base::sync_with_stdio(false);
     cin.tie(0), cout.tie(0);
     input();
     solve();
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1940 KiB
2Accepted0/08ms3064 KiB
3Accepted5/51ms2116 KiB
4Accepted5/52ms2112 KiB
5Accepted5/564ms4444 KiB
6Accepted5/565ms5216 KiB
7Accepted4/4184ms18268 KiB
8Accepted4/4168ms19192 KiB
9Accepted4/4172ms18860 KiB
10Accepted4/4175ms18928 KiB
11Accepted4/4155ms18868 KiB
12Accepted2/2148ms21532 KiB
13Accepted2/2189ms32412 KiB
14Accepted1/1188ms33976 KiB
15Accepted1/1194ms35560 KiB
16Accepted1/1199ms34324 KiB
17Accepted1/1195ms32152 KiB
18Accepted1/1119ms26144 KiB
19Accepted1/190ms27648 KiB