80562024-01-12 11:36:52bzsofiaLegmesszebbi rossz sorrendű (35 pont)cpp17Wrong answer 3/35254ms4920 KiB
// Sorrend.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <climits>
#include <vector>

using namespace std;

int i, n, j, maxt=INT_MIN, maxi, maxj;

int main()
{
    cin >> n;
    vector <int> x(n + 1);

    for (i = 1; i <= n; ++i)
    {
        cin >> x[i];
    }

    i = 1;
    j = n;
    while (i<j && j - i + 1>maxt)
    {
        if (x[i] > x[j])
        {
            maxt = j - i + 1;
            maxi = i;
            maxj = j;
            j = n;
            ++i;
        }
        else
        {
            if (i + 1 == j)
            {
                ++i;
                j = n;
            }
            else
            {
                --j;
            }
        }
    }

    if (maxi == 0 && maxj == 0) cout << "-1";
    else cout << maxi << " " << maxj;

    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base3/35
1Accepted0/03ms1812 KiB
2Wrong answer0/037ms2768 KiB
3Accepted1/13ms2272 KiB
4Accepted1/13ms2424 KiB
5Wrong answer0/13ms2640 KiB
6Accepted1/13ms2880 KiB
7Wrong answer0/13ms2936 KiB
8Wrong answer0/13ms3068 KiB
9Wrong answer0/13ms3432 KiB
10Wrong answer0/14ms3380 KiB
11Wrong answer0/14ms3512 KiB
12Wrong answer0/217ms3760 KiB
13Wrong answer0/218ms3720 KiB
14Wrong answer0/219ms3724 KiB
15Wrong answer0/213ms3960 KiB
16Wrong answer0/219ms3868 KiB
17Wrong answer0/227ms3992 KiB
18Wrong answer0/230ms4000 KiB
19Wrong answer0/235ms3992 KiB
20Wrong answer0/235ms4516 KiB
21Wrong answer0/237ms4920 KiB
22Wrong answer0/237ms4744 KiB
23Time limit exceeded0/2254ms3708 KiB
24Time limit exceeded0/2241ms3820 KiB