77142024-01-10 14:48:00CsongiKéséscpp17Time limit exceeded 0/50600ms20832 KiB
#include <iostream>
#include <bits/stdc++.h>
#include <unordered_set>

using namespace std;

int index(int v, const unordered_set<int> tomb)
{
	auto it = tomb.find(v);
	if (it != tomb.end())
	{
		return distance(tomb.begin(), it);
	}
}

int main()
{
    int n;
    cin >> n;
	unordered_set<int> szamok;
	vector<int> evek(n);
	for (int i = 0; i < n; i++)
	{
		int most;
		cin >> most;
		szamok.insert(most);
		evek[i] = most;
	}
	vector<int> talalat(szamok.size(), 0);
	int szaml = 0;
	for (int i = n-1; i >= 0; i--)
	{
		int asd = index(evek[i], szamok);
		if (talalat[asd] == 0)
		{
			talalat[asd++];
			szaml++;
		}

		if (szaml == talalat.size())
		{
			cout << i+1;
			break;
		}
	}
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms1812 KiB
2Time limit exceeded0/0600ms2236 KiB
3Wrong answer0/528ms2536 KiB
4Wrong answer0/520ms2732 KiB
5Wrong answer0/5119ms4132 KiB
6Wrong answer0/5119ms4056 KiB
7Time limit exceeded0/4570ms14012 KiB
8Time limit exceeded0/4574ms13680 KiB
9Time limit exceeded0/4569ms12812 KiB
10Time limit exceeded0/4569ms12256 KiB
11Time limit exceeded0/4546ms9856 KiB
12Time limit exceeded0/2561ms11672 KiB
13Time limit exceeded0/2542ms20832 KiB
14Time limit exceeded0/1559ms20612 KiB
15Time limit exceeded0/1570ms20300 KiB
16Time limit exceeded0/1582ms15336 KiB
17Time limit exceeded0/1565ms12428 KiB
18Time limit exceeded0/1582ms4380 KiB
19Time limit exceeded0/1574ms3636 KiB