結果

問題 No.616 へんなソート
ユーザー chocoruskchocorusk
提出日時 2018-09-22 09:46:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,722 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 2,218 ms
コンパイル使用メモリ 73,044 KB
実行使用メモリ 109,424 KB
最終ジャッジ日時 2023-09-25 10:58:23
合計ジャッジ時間 9,506 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
109,136 KB
testcase_01 AC 29 ms
109,128 KB
testcase_02 AC 28 ms
109,164 KB
testcase_03 AC 30 ms
109,160 KB
testcase_04 AC 28 ms
109,168 KB
testcase_05 AC 28 ms
109,412 KB
testcase_06 AC 28 ms
109,160 KB
testcase_07 AC 28 ms
109,296 KB
testcase_08 AC 29 ms
109,128 KB
testcase_09 AC 30 ms
109,128 KB
testcase_10 AC 29 ms
109,136 KB
testcase_11 AC 28 ms
109,132 KB
testcase_12 AC 39 ms
109,120 KB
testcase_13 AC 780 ms
109,360 KB
testcase_14 AC 32 ms
109,172 KB
testcase_15 AC 29 ms
109,424 KB
testcase_16 AC 28 ms
109,280 KB
testcase_17 AC 622 ms
109,232 KB
testcase_18 AC 221 ms
109,220 KB
testcase_19 AC 160 ms
109,220 KB
testcase_20 AC 29 ms
109,276 KB
testcase_21 AC 32 ms
109,124 KB
testcase_22 AC 74 ms
109,220 KB
testcase_23 AC 28 ms
109,156 KB
testcase_24 AC 28 ms
109,160 KB
testcase_25 AC 29 ms
109,196 KB
testcase_26 AC 66 ms
109,232 KB
testcase_27 AC 56 ms
109,132 KB
testcase_28 AC 1,722 ms
109,164 KB
testcase_29 AC 1,715 ms
109,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
int main()
{
	int n, k;
  cin>>n>>k;
  ll dp[301][45001]={};
  dp[1][0]=1;
  for(int i=1; i<n; i++){
    for(int j=0; j<=i; j++){
      for(int l=0; l<=i*(i-1)/2; l++){
        dp[i+1][j+l]+=dp[i][l];
        dp[i+1][j+l]%=MOD;
      }
    }
  }
  ll ans=0;
  for(int i=0; i<=k; i++){
    ans+=dp[n][i];
    ans%=MOD;
  }
  cout<<ans<<endl;
	return 0;
}
0