結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー | kusaf_ |
提出日時 | 2024-09-01 03:16:20 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 702 bytes |
コンパイル時間 | 3,070 ms |
コンパイル使用メモリ | 252,320 KB |
実行使用メモリ | 814,976 KB |
最終ジャッジ日時 | 2024-09-01 03:16:27 |
合計ジャッジ時間 | 5,849 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 MLE * 1 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using namespace atcoder; using ll = long long; using mint = modint1000000007; template<typename T> vector<vector<T>> Partition(int N) { vector<vector<T>> r(N + 1, vector<T>(N + 1, 0)); for(int i = 0; i <= N; i++) { r[0][i] = 1; } for(int i = 1; i <= N; i++) { for(int j = 1; j <= N; j++) { r[i][j] = r[i][j - 1] + (i - j >= 0 ? r[i - j][j] : 0); } } return r; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N, S, K; cin >> N >> S >> K; S -= K * N * (N - 1) / 2; if(S < 0) { cout << 0 << "\n"; return 0; } auto p = Partition<mint>(S); cout << p[S][N].val() << "\n"; }