62752023-11-11 13:05:33MrChipserLegmesszebbi rossz sorrendű (35 pont)cpp11Time limit exceeded 9/35300ms3772 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 =0; i <  s.size(); i++)
        {
            if(s[i]>a)
            {
                relativi=i;
                break;
            }
        }
        //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/0300ms1536 KiB
3Accepted1/13ms2120 KiB
4Accepted1/12ms2324 KiB
5Accepted1/13ms2532 KiB
6Accepted1/12ms2612 KiB
7Accepted1/12ms2612 KiB
8Accepted1/13ms2752 KiB
9Accepted1/14ms3120 KiB
10Accepted1/18ms3084 KiB
11Accepted1/112ms3216 KiB
12Time limit exceeded0/2286ms2868 KiB
13Time limit exceeded0/2261ms3348 KiB
14Time limit exceeded0/2230ms3472 KiB
15Time limit exceeded0/2268ms3560 KiB
16Time limit exceeded0/2264ms3556 KiB
17Time limit exceeded0/2268ms3484 KiB
18Time limit exceeded0/2250ms3612 KiB
19Time limit exceeded0/2273ms3728 KiB
20Time limit exceeded0/2264ms3772 KiB
21Time limit exceeded0/2264ms3576 KiB
22Time limit exceeded0/2277ms3644 KiB
23Time limit exceeded0/2240ms3560 KiB
24Time limit exceeded0/2273ms3648 KiB