結果

問題 No.616 へんなソート
ユーザー ミドリムシミドリムシ
提出日時 2018-02-09 17:39:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 635 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 65,136 KB
実行使用メモリ 28,672 KB
最終ジャッジ日時 2024-04-16 18:15:23
合計ジャッジ時間 9,326 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 28 ms
5,376 KB
testcase_13 TLE -
testcase_14 AC 8 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 1,596 ms
20,736 KB
testcase_18 AC 513 ms
11,264 KB
testcase_19 AC 349 ms
9,344 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 7 ms
5,376 KB
testcase_22 AC 121 ms
6,400 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 99 ms
6,144 KB
testcase_27 AC 75 ms
5,760 KB
testcase_28 TLE -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    long array_patterns[N + 1][N * (N + 1) / 2 + 1]; // now_array_size, now_inversion_number
    for(int i = 0; i <= N * (N + 1) / 2; i++){
        array_patterns[N][i] = (i <= K);
    }
    for(int i = N - 1; i >= 0; i--){
        for(int j = 0; j <= i * (i + 1) / 2; j++){
            long ans = 0;
            for(int k = 0; k <= i; k++){
                ans += array_patterns[i + 1][j + k];
                ans %= long(1e9 + 7);
            }
            array_patterns[i][j] = ans;
        }
    }
    cout << array_patterns[0][0] << endl;
}

0