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



int main() {
	int n;
	cin >> n;
	vector<pair<int, int> > nagy;
	int kezd=-1, veg=-1;
	int utso=0;
	for (int i=0; i<n; i++) {
		int x;
		cin >> x;
		if (x>utso) {
			utso=x;
			nagy.push_back({x, i});
		}
		else {
			int y=-1;
			for (int 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/037ms2000 KiB
3Wrong answer0/13ms2220 KiB
4Accepted1/12ms2296 KiB
5Accepted1/13ms2436 KiB
6Accepted1/12ms2512 KiB
7Accepted1/13ms2756 KiB
8Wrong answer0/13ms2972 KiB
9Wrong answer0/13ms2968 KiB
10Wrong answer0/14ms3052 KiB
11Wrong answer0/14ms3044 KiB
12Wrong answer0/217ms3032 KiB
13Wrong answer0/217ms3032 KiB
14Wrong answer0/219ms3168 KiB
15Wrong answer0/213ms3244 KiB
16Wrong answer0/219ms3244 KiB
17Wrong answer0/227ms3376 KiB
18Wrong answer0/230ms3588 KiB
19Wrong answer0/234ms3800 KiB
20Wrong answer0/235ms3880 KiB
21Wrong answer0/237ms4000 KiB
22Wrong answer0/237ms4136 KiB
23Accepted2/235ms6244 KiB
24Accepted2/235ms6372 KiB