結果
問題 | No.1011 Infinite Stairs |
ユーザー | rxoxixyxd |
提出日時 | 2020-03-21 16:55:16 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 206 ms / 2,000 ms |
コード長 | 1,229 bytes |
コンパイル時間 | 1,341 ms |
コンパイル使用メモリ | 164,364 KB |
実行使用メモリ | 427,496 KB |
最終ジャッジ日時 | 2023-09-24 11:06:44 |
合計ジャッジ時間 | 4,148 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
7,428 KB |
testcase_01 | AC | 3 ms
9,572 KB |
testcase_02 | AC | 48 ms
191,556 KB |
testcase_03 | AC | 177 ms
359,864 KB |
testcase_04 | AC | 84 ms
261,188 KB |
testcase_05 | AC | 206 ms
427,496 KB |
testcase_06 | AC | 2 ms
7,428 KB |
testcase_07 | AC | 29 ms
120,296 KB |
testcase_08 | AC | 2 ms
7,688 KB |
testcase_09 | AC | 3 ms
9,500 KB |
testcase_10 | AC | 14 ms
55,880 KB |
testcase_11 | AC | 86 ms
250,088 KB |
testcase_12 | AC | 14 ms
55,576 KB |
testcase_13 | AC | 50 ms
139,380 KB |
testcase_14 | AC | 16 ms
69,472 KB |
testcase_15 | AC | 68 ms
199,764 KB |
testcase_16 | AC | 150 ms
339,352 KB |
testcase_17 | AC | 58 ms
221,164 KB |
testcase_18 | AC | 103 ms
241,884 KB |
testcase_19 | AC | 11 ms
43,236 KB |
testcase_20 | AC | 11 ms
42,772 KB |
testcase_21 | AC | 53 ms
140,412 KB |
testcase_22 | AC | 101 ms
253,212 KB |
testcase_23 | AC | 56 ms
132,524 KB |
testcase_24 | AC | 67 ms
166,632 KB |
testcase_25 | AC | 104 ms
258,756 KB |
testcase_26 | AC | 31 ms
86,272 KB |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < n; ++i) #define ALL(c) (c).begin(), (c).end() #define SUM(x) std::accumulate(ALL(x), 0LL) #define MIN(v) *std::min_element(v.begin(), v.end()) #define MAX(v) *std::max_element(v.begin(), v.end()) #define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end()) using namespace std; typedef long long ll; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1e9; const long long INFL = 1LL<<60; const int mod = 1000000007; ll dp[305][90005]; // i 回移動を行ったときにj段目にいる場合の数 ll sum[305][90005]; int main() { int N, D, K; cin >> N >> D >> K; dp[0][0] = 1; sum[0][0] = 1; for (int i = 0; i < N; i++) { for (int j = 0; j <= K; j++) { if (j - D > 0) dp[i+1][j] = (sum[i][j] - sum[i][j-D]) % mod; else dp[i+1][j] = (sum[i][j] - sum[i][0]) % mod; sum[i][j+1] = sum[i][j] + dp[i][j]; } } /* rep(i, n+1) { rep(j, n*d + 1) { cerr << dp[i][j] << " "; } cerr << endl; } */ cout << dp[N][K] << endl; return 0; }