42772023-03-21 15:44:13Tibi23Negáló rendezés (55 pont)cpp11Time limit exceeded 11/55300ms3856 KiB
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;


    int main()
{
    int N;
    cin>>N;
    int szamok[N];
    for(int i=0; i<N; i++){
        cin>>szamok[i];
    }
    int db=0;

    sort(szamok,szamok+N);
    do {
        bool hiba = false;
        bool csokken = true;
        for(int i=1; i<N; i++){
            if (szamok[i]>szamok[i-1]){
                if(csokken==true)
                    csokken=false;

            }
            if(szamok[i]<szamok[i-1] && csokken==false)
            {
                hiba=true;
                break;
            }
        }
        if(hiba==true)
            continue;

        db=(db+1)%1000000007;


    } while ( std::next_permutation(szamok,szamok+N) );
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base11/55
1Accepted0/03ms1880 KiB
2Time limit exceeded0/0300ms1644 KiB
3Accepted2/23ms2364 KiB
4Accepted2/23ms2596 KiB
5Accepted2/23ms2844 KiB
6Accepted2/23ms2856 KiB
7Accepted3/33ms2940 KiB
8Time limit exceeded0/2300ms3000 KiB
9Time limit exceeded0/3263ms3252 KiB
10Time limit exceeded0/3250ms2724 KiB
11Time limit exceeded0/3256ms2940 KiB
12Time limit exceeded0/3266ms3112 KiB
13Time limit exceeded0/3266ms3404 KiB
14Time limit exceeded0/3259ms3260 KiB
15Time limit exceeded0/3266ms3620 KiB
16Time limit exceeded0/3246ms3484 KiB
17Time limit exceeded0/3270ms3480 KiB
18Time limit exceeded0/3275ms3600 KiB
19Time limit exceeded0/3279ms3612 KiB
20Time limit exceeded0/3266ms3840 KiB
21Time limit exceeded0/3250ms3856 KiB
22Time limit exceeded0/3275ms3828 KiB