結果

問題 No.616 へんなソート
ユーザー Mr.SpockMr.Spock
提出日時 2021-02-09 23:35:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 845 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 93,480 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-21 11:07:06
合計ジャッジ時間 8,699 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 750 ms
4,380 KB
testcase_14 AC 5 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 341 ms
4,380 KB
testcase_18 AC 32 ms
4,376 KB
testcase_19 AC 38 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 10 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,384 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 TLE -
testcase_29 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <cstring>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k;
	cin >> n >> k;
	vector<int>v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	vector<int>dp1(k + 1, 0);
	dp1[0] = 1;
	for (int i = 0; i < n; i++) {
		vector<int>dp2(k + 1, 0);
		for (int x = 0; x <= i; x++) {
			for (int y = 0; y + x <= k; y++) {
				dp2[x + y] += dp1[y];
				dp2[x + y] %= mod;
			}
		}
		swap(dp1, dp2);
	}
	int ans = 0;
	for (int i = 0; i <= k; i++) {
		ans += dp1[i];
		ans %= mod;
	}
	cout << ans << endl;
}
0