77152024-01-10 14:50:55CsongiKéséscpp17Wrong answer 0/50600ms13260 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);
	}
	else
		return 0;
}

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/03ms1816 KiB
2Wrong answer0/0133ms3028 KiB
3Wrong answer0/53ms2428 KiB
4Wrong answer0/53ms2460 KiB
5Wrong answer0/554ms4124 KiB
6Wrong answer0/554ms4336 KiB
7Time limit exceeded0/4600ms9080 KiB
8Time limit exceeded0/4565ms8920 KiB
9Time limit exceeded0/4535ms8352 KiB
10Time limit exceeded0/4546ms8060 KiB
11Time limit exceeded0/4563ms6604 KiB
12Time limit exceeded0/2566ms8204 KiB
13Time limit exceeded0/2572ms13260 KiB
14Time limit exceeded0/1568ms13244 KiB
15Time limit exceeded0/1555ms13116 KiB
16Time limit exceeded0/1563ms10052 KiB
17Time limit exceeded0/1559ms8648 KiB
18Wrong answer0/1275ms6084 KiB
19Wrong answer0/1137ms5560 KiB