結果

問題 No.616 へんなソート
ユーザー kurarrrkurarrr
提出日時 2018-02-21 12:18:04
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,218 bytes
コンパイル時間 1,396 ms
コンパイル使用メモリ 144,048 KB
実行使用メモリ 216,908 KB
最終ジャッジ日時 2023-10-12 22:22:13
合計ジャッジ時間 3,821 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,724 KB
testcase_01 AC 2 ms
7,408 KB
testcase_02 AC 3 ms
13,572 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
5,716 KB
testcase_06 AC 7 ms
26,108 KB
testcase_07 AC 4 ms
15,716 KB
testcase_08 AC 7 ms
28,000 KB
testcase_09 AC 9 ms
36,216 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,356 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 5 ms
6,060 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 1 ms
4,352 KB
testcase_25 AC 2 ms
4,356 KB
testcase_26 AC 2 ms
4,352 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 263 ms
215,892 KB
testcase_29 AC 227 ms
216,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define show_table(n, k, table) rep(i,n){ rep(j,k) cout << table[i][j] << " "; cout << endl;}

template<class T> void chmax(T& a,const T& b){a=max(a,b);}
template<class T> void chmin(T& a,const T& b){a=min(a,b);}

using namespace std;

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;
const int MAX_N = 302;

ll dp[MAX_N][MAX_N*MAX_N/2],sum[MAX_N][MAX_N*MAX_N/2];

int main(){
  int N,K; cin >> N >> K;
  // int a; rep(i,N) cin >> a;
  dp[0][0] = 1;
  rep(j,K+1) sum[0][j] = 1LL;
  REP(i,1,N){
    rep(j,K+1){
      if(min(i,j)<=j-1) dp[i][j] = (sum[i-1][j] - sum[i-1][j-min(i,j)-1])%lmod;
      else dp[i][j] = sum[i-1][j];
    }
    sum[i][0] = 1LL;
    REP(j,1,K+1) sum[i][j] = (sum[i][j-1] + dp[i][j])%lmod;
  }
  // show_table(N,K+1,dp);
  cout << sum[N-1][K] << endl;
  return 0;
}
0