42802023-03-21 16:01:27pyramisNegáló rendezés (55 pont)cpp11Time limit exceeded 11/55300ms3900 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==false)
            db=(db+1)%1000000007;





    } while ( std::next_permutation(szamok,szamok+N) );
    cout<<db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base11/55
1Accepted0/03ms1872 KiB
2Time limit exceeded0/0300ms1640 KiB
3Accepted2/23ms2040 KiB
4Accepted2/23ms2176 KiB
5Accepted2/23ms2380 KiB
6Accepted2/23ms2460 KiB
7Accepted3/33ms2592 KiB
8Time limit exceeded0/2300ms2676 KiB
9Time limit exceeded0/3272ms2648 KiB
10Time limit exceeded0/3273ms2140 KiB
11Time limit exceeded0/3264ms2380 KiB
12Time limit exceeded0/3263ms2632 KiB
13Time limit exceeded0/3263ms2780 KiB
14Time limit exceeded0/3239ms3068 KiB
15Time limit exceeded0/3272ms3208 KiB
16Time limit exceeded0/3268ms3156 KiB
17Time limit exceeded0/3272ms3340 KiB
18Time limit exceeded0/3259ms3488 KiB
19Time limit exceeded0/3263ms3688 KiB
20Time limit exceeded0/3216ms3900 KiB
21Time limit exceeded0/3280ms3712 KiB
22Time limit exceeded0/3259ms3896 KiB