94592024-02-22 08:12:01csaron71Legmesszebbi rossz sorrendű (35 pont)cpp17Wrong answer 10/3537ms7836 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=10e5+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 (y!=10e5+1 && veg - kezd < i - y) {
				veg=i;
				kezd=y;
			}
		}
	}
	cout << kezd+1 << " " << veg+1 << "\n";
}
SubtaskSumTestVerdictTimeMemory
base10/35
1Accepted0/03ms1812 KiB
2Wrong answer0/037ms2060 KiB
3Wrong answer0/12ms2116 KiB
4Accepted1/12ms2188 KiB
5Accepted1/12ms2304 KiB
6Accepted1/12ms2300 KiB
7Accepted1/12ms2308 KiB
8Wrong answer0/13ms2428 KiB
9Accepted1/13ms2688 KiB
10Wrong answer0/14ms2780 KiB
11Accepted1/14ms2968 KiB
12Wrong answer0/216ms3052 KiB
13Wrong answer0/217ms3032 KiB
14Wrong answer0/218ms3156 KiB
15Wrong answer0/213ms3396 KiB
16Wrong answer0/219ms3608 KiB
17Wrong answer0/228ms3692 KiB
18Wrong answer0/229ms3696 KiB
19Wrong answer0/232ms3800 KiB
20Wrong answer0/234ms3656 KiB
21Wrong answer0/237ms3656 KiB
22Wrong answer0/237ms3812 KiB
23Accepted2/235ms7836 KiB
24Accepted2/235ms7828 KiB