49032023-04-06 15:35:22KaukazusLegmesszebbi rossz sorrendű (35 pont)cpp17Wrong answer 10/3550ms15276 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<vector<int>> v;
	v.push_back(vector<int>(1,0));
	for(int i=0;i<n;i++){
		int valt;
		cin >> valt;
		if(v[v.size()-1][0]<valt){
			v.push_back(vector<int>(1,valt));
			v[v.size()-1].push_back(i+1);
		}
		else{
			for(int x=1;x<v.size();x++){
				if(v[x][0]>valt){
					v[x].push_back(i+1);
				}
			}
		}
	}
	int maxi=-1, veg1,veg2;
	for(int i=1;i<v.size();i++){
		if(v[i][1]!=v[i][v[i].size()-1]){
			if(v[i][v[i].size()-1]-v[i][1]>maxi){
				maxi=v[i][v[i].size()-1]-v[i][1];
				veg1=v[i][1];
				veg2=v[i][v[i].size()-1];
			}
		}
		/*for(int x=0;x<v[i].size();x++){
			cout << v[i][x] << " ";
		}
		cout << endl;*/
	}
	cout << veg1 << " " << veg2;
}
SubtaskSumTestVerdictTimeMemory
base10/35
1Accepted0/03ms1816 KiB
2Wrong answer0/039ms5952 KiB
3Wrong answer0/13ms2212 KiB
4Accepted1/12ms2300 KiB
5Accepted1/13ms2548 KiB
6Accepted1/13ms2756 KiB
7Accepted1/13ms2756 KiB
8Wrong answer0/13ms2760 KiB
9Accepted1/13ms3024 KiB
10Wrong answer0/14ms3128 KiB
11Accepted1/14ms3140 KiB
12Wrong answer0/216ms3028 KiB
13Wrong answer0/217ms3208 KiB
14Wrong answer0/218ms3420 KiB
15Wrong answer0/213ms3640 KiB
16Wrong answer0/219ms3852 KiB
17Wrong answer0/228ms8136 KiB
18Wrong answer0/232ms7716 KiB
19Wrong answer0/235ms7024 KiB
20Wrong answer0/234ms4368 KiB
21Wrong answer0/239ms7880 KiB
22Wrong answer0/239ms8404 KiB
23Accepted2/248ms15004 KiB
24Accepted2/250ms15276 KiB