91602024-02-16 16:44:40bovizdbLegmesszebbi rossz sorrendű (35 pont)cpp17Time limit exceeded 31/35222ms6580 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	int mx = -100001, ind = -1, len = 0;
	vector<int> vmx;
	for (int i = 0; i < n; i++)
	{
		if (v[i] > mx)
		{
			mx = v[i];
			vmx.push_back(i);
			continue;
		}
		else if (v[i] < mx)
		{
			for (int j = 0; j < vmx.size(); j++)
			{
				if (i - vmx[j] <= len)
				{
					break;
				}
				if (v[i] < v[vmx[j]])
				{
					ind = vmx[j];
					len = i-vmx[j];
				}
			}
		}
	}
	if (ind == -1) cout << ind;
	else cout << ind+1 << " " << ind+len+1;
}
SubtaskSumTestVerdictTimeMemory
base31/35
1Accepted0/03ms1816 KiB
2Accepted0/0119ms2716 KiB
3Accepted1/13ms2220 KiB
4Accepted1/12ms2296 KiB
5Accepted1/13ms2428 KiB
6Accepted1/12ms2512 KiB
7Accepted1/12ms2624 KiB
8Accepted1/13ms2648 KiB
9Accepted1/13ms2756 KiB
10Accepted1/14ms2868 KiB
11Accepted1/14ms3100 KiB
12Accepted2/2145ms3716 KiB
13Accepted2/2182ms3944 KiB
14Time limit exceeded0/2203ms4180 KiB
15Accepted2/286ms4208 KiB
16Time limit exceeded0/2222ms4480 KiB
17Accepted2/261ms4416 KiB
18Accepted2/278ms4312 KiB
19Accepted2/293ms4828 KiB
20Accepted2/297ms4784 KiB
21Accepted2/2115ms5060 KiB
22Accepted2/2119ms5152 KiB
23Accepted2/235ms6580 KiB
24Accepted2/235ms6504 KiB