91592024-02-16 16:41:07bovizdbLegmesszebbi rossz sorrendű (35 pont)cpp17Time limit exceeded 31/35224ms6680 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
		{
			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/03ms1812 KiB
2Accepted0/0119ms2708 KiB
3Accepted1/13ms2228 KiB
4Accepted1/13ms2428 KiB
5Accepted1/13ms2672 KiB
6Accepted1/13ms2552 KiB
7Accepted1/13ms2684 KiB
8Accepted1/13ms2772 KiB
9Accepted1/14ms2880 KiB
10Accepted1/14ms3092 KiB
11Accepted1/14ms3308 KiB
12Accepted2/2148ms3684 KiB
13Accepted2/2184ms3700 KiB
14Time limit exceeded0/2204ms3864 KiB
15Accepted2/286ms3776 KiB
16Time limit exceeded0/2224ms4072 KiB
17Accepted2/261ms4128 KiB
18Accepted2/276ms4204 KiB
19Accepted2/292ms4996 KiB
20Accepted2/297ms4896 KiB
21Accepted2/2115ms4952 KiB
22Accepted2/2119ms5092 KiB
23Accepted2/235ms6520 KiB
24Accepted2/237ms6680 KiB