結果
問題 | No.616 へんなソート |
ユーザー | ikd |
提出日時 | 2017-12-17 02:45:51 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 610 bytes |
コンパイル時間 | 767 ms |
コンパイル使用メモリ | 73,932 KB |
実行使用メモリ | 56,576 KB |
最終ジャッジ日時 | 2024-05-08 17:25:22 |
合計ジャッジ時間 | 4,602 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 2 ms
5,376 KB |
testcase_24 | AC | 2 ms
5,376 KB |
testcase_25 | AC | 2 ms
5,376 KB |
testcase_26 | AC | 1 ms
5,376 KB |
testcase_27 | AC | 1 ms
5,376 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
ソースコード
#include<iostream> #include<vector> #include<cassert> using namespace std; int main(){ int n, k; cin>> n>> k; int a[n]; for(int i=0; i<n; i++) cin>> a[i]; const int mod=1e9+7; vector<vector<int>> dp(n+1, vector<int>(k+1, 0)); for(int i=1; i<=n; i++) dp[i][0]=1; for(int i=2; i<=n; i++)for(int j=1; j<=k && j<=i*(i-1)/2; j++){ (dp[i][j]+=dp[i-1][j])%=mod; (dp[i][j]+=dp[i][j-1])%=mod; if(j-i>=0){ assert(dp[i][j]>=dp[i-1][j-1]); (dp[i][j]-=dp[i-1][j-i])%=mod; } } int ans=0; for(int j=0; j<=k; j++) (ans+=dp[n][j])%=mod; cout<< ans<< endl; return 0; }