125002024-12-19 12:10:12tamasmarkKövetkező permutáció (50 pont)cpp17Wrong answer 6/50298ms512 KiB
// permutacio.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>

using namespace std;
int n, j, i;
vector<int>x;
bool jo=true;
int main()
{
    cin >> n;
    x.resize(n + 1);
    for (i = 1; i <= n; ++i)
        cin >> x[i];

    while (next_permutation(x.begin() + 1, x.end()))
    {
        jo = true;
        for (i = 2; i < n; ++i)
        {
            if (x[i - 1] > x[i] && x[i - 1] > x[i + 1] && x[i] < x[i + 1])
            {
                jo = false;
                break;
            }
        }
        if (jo)
        {
            for (i = 1; i <= n; ++i)
                cout << x[i] << " ";
            break;
        }
    }
    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
base6/50
1Wrong answer0/01ms320 KiB
2Time limit exceeded0/0282ms320 KiB
3Accepted1/11ms320 KiB
4Accepted1/11ms320 KiB
5Wrong answer0/11ms320 KiB
6Wrong answer0/11ms320 KiB
7Wrong answer0/21ms320 KiB
8Wrong answer0/21ms500 KiB
9Wrong answer0/21ms320 KiB
10Accepted2/21ms320 KiB
11Wrong answer0/125ms404 KiB
12Wrong answer0/126ms400 KiB
13Wrong answer0/125ms404 KiB
14Wrong answer0/125ms512 KiB
15Time limit exceeded0/3287ms496 KiB
16Time limit exceeded0/3289ms320 KiB
17Time limit exceeded0/3275ms500 KiB
18Time limit exceeded0/3280ms320 KiB
19Time limit exceeded0/3284ms320 KiB
20Time limit exceeded0/3286ms320 KiB
21Time limit exceeded0/3282ms320 KiB
22Time limit exceeded0/3279ms320 KiB
23Time limit exceeded0/3282ms320 KiB
24Time limit exceeded0/3282ms320 KiB
25Time limit exceeded0/2298ms320 KiB
26Accepted2/24ms320 KiB