結果
| 問題 |
No.616 へんなソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-09 23:35:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 845 bytes |
| コンパイル時間 | 663 ms |
| コンパイル使用メモリ | 96,224 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-07 05:05:50 |
| 合計ジャッジ時間 | 7,057 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 TLE * 2 |
ソースコード
#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;
}