131352025-01-06 18:04:32HolloGInverziócpp17Wrong answer 3/5061ms4364 KiB
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);

    int n; cin >> n;
	vector<int> sor(n);
	vector<int> indexek(n + 1);
	for (int i = 0; i < n; i++)
	{
		cin >> sor[i];
		indexek[sor[i]] = i + 1;
	}
	int maxd = 0, maxi = 0, maxj = 0;
	for (int i = 1; i < n+1; i++)
	{
		maxj = max(maxj, indexek[i - 1]);
		if (indexek[i] < maxj)
		{
			int prev = maxd;
			maxd = max(maxd, indexek[maxj] - indexek[i]);
			if (maxd != prev) maxi = indexek[i];
		}
	}
	if (maxd == 0) cout << -1;
	else cout << maxi << " " << maxj;
}

SubtaskSumTestVerdictTimeMemory
base3/50
1Accepted0/01ms316 KiB
2Wrong answer0/06ms820 KiB
3Accepted1/11ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/71ms316 KiB
6Wrong answer0/26ms820 KiB
7Wrong answer0/257ms4348 KiB
8Wrong answer0/261ms4352 KiB
9Wrong answer0/259ms4352 KiB
10Wrong answer0/261ms4332 KiB
11Wrong answer0/259ms4148 KiB
12Wrong answer0/259ms4272 KiB
13Wrong answer0/259ms4356 KiB
14Wrong answer0/259ms4148 KiB
15Wrong answer0/259ms4148 KiB
16Wrong answer0/259ms4152 KiB
17Wrong answer0/259ms4352 KiB
18Wrong answer0/257ms4148 KiB
19Wrong answer0/359ms4356 KiB
20Wrong answer0/357ms4148 KiB
21Wrong answer0/257ms4148 KiB
22Wrong answer0/259ms4148 KiB
23Wrong answer0/259ms4364 KiB
24Accepted2/257ms4148 KiB