結果

問題 No.616 へんなソート
ユーザー ミドリムシミドリムシ
提出日時 2018-02-09 17:31:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 861 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 71,868 KB
実行使用メモリ 220,032 KB
最終ジャッジ日時 2024-04-16 18:08:22
合計ジャッジ時間 15,426 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
220,032 KB
testcase_01 AC 158 ms
214,400 KB
testcase_02 AC 157 ms
214,400 KB
testcase_03 AC 158 ms
214,528 KB
testcase_04 AC 160 ms
214,656 KB
testcase_05 AC 155 ms
214,528 KB
testcase_06 AC 158 ms
214,400 KB
testcase_07 AC 156 ms
214,656 KB
testcase_08 AC 158 ms
214,400 KB
testcase_09 AC 161 ms
214,400 KB
testcase_10 AC 158 ms
214,400 KB
testcase_11 AC 159 ms
214,528 KB
testcase_12 AC 190 ms
214,656 KB
testcase_13 TLE -
testcase_14 AC 166 ms
214,528 KB
testcase_15 AC 156 ms
214,656 KB
testcase_16 AC 158 ms
214,400 KB
testcase_17 TLE -
testcase_18 AC 816 ms
214,528 KB
testcase_19 AC 603 ms
214,656 KB
testcase_20 AC 157 ms
214,528 KB
testcase_21 AC 164 ms
214,528 KB
testcase_22 AC 309 ms
214,528 KB
testcase_23 AC 156 ms
214,528 KB
testcase_24 AC 157 ms
214,528 KB
testcase_25 AC 157 ms
214,400 KB
testcase_26 AC 282 ms
214,528 KB
testcase_27 AC 251 ms
214,400 KB
testcase_28 TLE -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

int N, K;

long dp[300][90000];

long array_patterns(int now_array_size, int now_inversion_number){
    if(now_array_size == N){
        return now_inversion_number <= K;
    }else if(dp[now_array_size][now_inversion_number] != -1){
        return dp[now_array_size][now_inversion_number];
    }else{
        long ans = 0;
        for(int i = 0; i <= now_array_size; i++){
            ans += array_patterns(now_array_size + 1, now_inversion_number + i);
            ans %= long(1e9 + 7);
        }
        return dp[now_array_size][now_inversion_number] = ans;
    }
}

int main(){
    cin >> N >> K;
    for(int i = 0; i < 300; i++){
        for(int j = 0; j < 90000; j++){
            dp[i][j] = -1;
        }
    }
    cout << array_patterns(0, 0) << endl;
}

0