237792026-01-29 10:40:49SzeredaiNatanaelLegmesszebbi rossz sorrendű (35 pont)cpp17Time limit exceeded 1/35300ms1608 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n; cin >> n;
	vector<pair<int, int>> v(n);
	for (int i = 0; i < n; ++i) {
		cin >> v[i].first;
		v[i].second = i + 1;
	}

	sort(v.begin(), v.end());

	int maxi = 1, pi1, pi2, pj1, pj2, s, ans = 1;
	for (int i = 1; i < n; ++i) {
		for (int j = i - 1; j >= 0; --j) {
			if (v[i].second > v[j].first) {
				s = abs(v[j].second - v[i].second);
				if (s > maxi) {
					maxi = s;
					pi1 = v[j].second;
					pj1 = v[i].second;
				}
			}
			else break;
		}
		if (maxi > ans) {
			ans = maxi;
			pi2 = pi1;
			pj2 = pj1;
		}
	}
	cout << pi2 - 1 << " " << pj2 << "\n";
}
SubtaskSumTestVerdictTimeMemory
base1/35
1Accepted0/01ms316 KiB
2Time limit exceeded0/0282ms1076 KiB
3Wrong answer0/11ms316 KiB
4Accepted1/11ms316 KiB
5Wrong answer0/11ms316 KiB
6Wrong answer0/11ms316 KiB
7Wrong answer0/11ms316 KiB
8Wrong answer0/12ms316 KiB
9Wrong answer0/13ms316 KiB
10Wrong answer0/14ms316 KiB
11Wrong answer0/13ms452 KiB
12Time limit exceeded0/2300ms564 KiB
13Time limit exceeded0/2300ms564 KiB
14Time limit exceeded0/2298ms564 KiB
15Time limit exceeded0/2293ms564 KiB
16Time limit exceeded0/2284ms1272 KiB
17Time limit exceeded0/2286ms820 KiB
18Time limit exceeded0/2298ms1076 KiB
19Time limit exceeded0/2287ms1588 KiB
20Time limit exceeded0/2277ms1608 KiB
21Time limit exceeded0/2277ms1272 KiB
22Time limit exceeded0/2300ms1076 KiB
23Time limit exceeded0/2277ms1076 KiB
24Time limit exceeded0/2280ms1076 KiB