62742023-11-11 13:02:54MrChipserLegmesszebbi rossz sorrendű (35 pont)cpp11Time limit exceeded 9/35300ms3364 KiB
#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
int a[100000];
int main()
{
    ifstream fin("a.txt");
    int n;
    cin >> n;
    vector<int>s;
    int maxim =-1;
    int maxim1 =-1;
    int maxim2 =-1;
    for(int i  =0; i < n; i++)
    {
        int a;
        cin >> a;
        int relativi =-1;
        for(int i = s.size()-1; i >= 0; i--)
        {
            if(s[i]>a)
            {
                relativi=i;
            }
        }
        //cout << i << " " << relativi << endl;
        int lokaltav = i-relativi;
        if((lokaltav > maxim && relativi!=-1) or (lokaltav==maxim && relativi!=-1 && relativi < maxim1))
        {
            maxim = lokaltav;
            maxim1 = relativi;
            maxim2= i;
        }
        s.push_back(a);
    }
    if(maxim!=-1)
    cout << maxim1+1 << " " << maxim2+1;
    else
        cout << -1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base9/35
1Accepted0/03ms1816 KiB
2Time limit exceeded0/0300ms1520 KiB
3Accepted1/13ms2256 KiB
4Accepted1/13ms2492 KiB
5Accepted1/13ms2552 KiB
6Accepted1/13ms2788 KiB
7Accepted1/13ms3004 KiB
8Accepted1/13ms3016 KiB
9Accepted1/14ms3204 KiB
10Accepted1/17ms3308 KiB
11Accepted1/19ms3312 KiB
12Time limit exceeded0/2300ms2796 KiB
13Time limit exceeded0/2277ms2748 KiB
14Time limit exceeded0/2286ms3036 KiB
15Time limit exceeded0/2261ms3044 KiB
16Time limit exceeded0/2277ms3164 KiB
17Time limit exceeded0/2277ms3176 KiB
18Time limit exceeded0/2256ms3364 KiB
19Time limit exceeded0/2252ms2984 KiB
20Time limit exceeded0/2264ms2988 KiB
21Time limit exceeded0/2268ms3064 KiB
22Time limit exceeded0/2240ms3144 KiB
23Time limit exceeded0/2264ms3208 KiB
24Time limit exceeded0/2256ms2996 KiB