94092024-02-21 13:54:42csaron71Legmesszebbi rossz sorrendű (35 pont)cpp17Wrong answer 8/3537ms8640 KiB
#include <bits/stdc++.h>
using namespace std;



int main() {
	long long n;
	cin >> n;
	vector<pair<long long, long long> > nagy;
	long long kezd=-1, veg=-1;
	long long utso=0;
	for (long long i=0; i<n; i++) {
		long long x;
		cin >> x;
		if (x>utso) {
			utso=x;
			nagy.push_back({x, i});
		}
		else {
			long long y=-1;
			for (long long j=0; j<nagy.size(); j++) {
				if (x<nagy[j].first) {
					y=nagy[j].second;
					//cout << x << "  "  << nagy[j].first << "    ";
					break;
				}
			}
			//cout << i+1 << " " << y+1 << "\n";
			if (veg-kezd<i-y) {
				veg=i;
				kezd=y;
			}
		}
	}
	cout << kezd+1 << " " << veg+1 << "\n";
}
SubtaskSumTestVerdictTimeMemory
base8/35
1Accepted0/03ms1808 KiB
2Wrong answer0/037ms2008 KiB
3Wrong answer0/13ms2244 KiB
4Accepted1/13ms2464 KiB
5Accepted1/13ms2696 KiB
6Accepted1/13ms2784 KiB
7Accepted1/13ms3028 KiB
8Wrong answer0/13ms3208 KiB
9Wrong answer0/13ms3372 KiB
10Wrong answer0/14ms3720 KiB
11Wrong answer0/14ms3604 KiB
12Wrong answer0/217ms3448 KiB
13Wrong answer0/218ms3568 KiB
14Wrong answer0/219ms3696 KiB
15Wrong answer0/213ms3744 KiB
16Wrong answer0/219ms3868 KiB
17Wrong answer0/227ms3972 KiB
18Wrong answer0/229ms4056 KiB
19Wrong answer0/232ms4180 KiB
20Wrong answer0/234ms4264 KiB
21Wrong answer0/237ms4400 KiB
22Wrong answer0/237ms4500 KiB
23Accepted2/235ms8568 KiB
24Accepted2/237ms8640 KiB