結果
問題 |
No.616 へんなソート
|
ユーザー |
|
提出日時 | 2017-12-31 03:32:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 670 bytes |
コンパイル時間 | 550 ms |
コンパイル使用メモリ | 66,248 KB |
実行使用メモリ | 116,384 KB |
最終ジャッジ日時 | 2024-12-21 13:55:22 |
合計ジャッジ時間 | 9,176 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 TLE * 2 |
ソースコード
#include <algorithm> #include <iostream> #include <numeric> #include <vector> using Int = long long; const Int M = 1000000000 + 7; int main() { int n, k; std::cin >> n >> k; std::vector<std::vector<Int>> count(n + 1, std::vector<Int>(k + 1, 0)); count[0][0] = 1; for (int ni = 0; ni < n; ++ni) { for (int ki = 0; ki <= k; ++ki) { for (int nj = 0; nj <= ni; ++nj) { int next_inv = ki + nj; if (next_inv > k) continue; count[ni + 1][next_inv] = (count[ni + 1][next_inv] + count[ni][ki]) % M; } } } Int ans = 0; for (const auto & c : count[n]) ans = (ans + c) % M; std::cout << ans << std::endl; return 0; }