結果
問題 | No.1011 Infinite Stairs |
ユーザー | どらら |
提出日時 | 2020-03-20 21:44:46 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 275 ms / 2,000 ms |
コード長 | 1,755 bytes |
コンパイル時間 | 1,631 ms |
コンパイル使用メモリ | 166,544 KB |
実行使用メモリ | 218,804 KB |
最終ジャッジ日時 | 2023-09-24 10:55:33 |
合計ジャッジ時間 | 6,991 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 61 ms
218,504 KB |
testcase_01 | AC | 64 ms
218,528 KB |
testcase_02 | AC | 242 ms
218,604 KB |
testcase_03 | AC | 263 ms
218,672 KB |
testcase_04 | AC | 273 ms
218,800 KB |
testcase_05 | AC | 275 ms
218,524 KB |
testcase_06 | AC | 60 ms
218,356 KB |
testcase_07 | AC | 171 ms
218,596 KB |
testcase_08 | AC | 58 ms
218,452 KB |
testcase_09 | AC | 60 ms
218,524 KB |
testcase_10 | AC | 107 ms
218,556 KB |
testcase_11 | AC | 250 ms
218,516 KB |
testcase_12 | AC | 108 ms
218,608 KB |
testcase_13 | AC | 161 ms
218,632 KB |
testcase_14 | AC | 123 ms
218,800 KB |
testcase_15 | AC | 212 ms
218,508 KB |
testcase_16 | AC | 249 ms
218,672 KB |
testcase_17 | AC | 259 ms
218,624 KB |
testcase_18 | AC | 205 ms
218,676 KB |
testcase_19 | AC | 95 ms
218,508 KB |
testcase_20 | AC | 95 ms
218,512 KB |
testcase_21 | AC | 154 ms
218,512 KB |
testcase_22 | AC | 227 ms
218,544 KB |
testcase_23 | AC | 143 ms
218,520 KB |
testcase_24 | AC | 172 ms
218,508 KB |
testcase_25 | AC | 228 ms
218,512 KB |
testcase_26 | AC | 124 ms
218,804 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; static const long long mod = 1000000007; struct mint { long long x; mint(ll x = 0):x(x%mod) {} mint& operator+=(const mint a) { (x += a.x) %= mod; return *this; } mint& operator-=(const mint a) { (x += mod-a.x) %= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint ret(*this); return ret += a; } mint operator-(const mint a) const { mint ret(*this); return ret -= a; } mint operator*(const mint a) const { mint ret(*this); return ret *= a; } mint pow(ll t) const { if(t==0) return mint(1); mint a = pow(t>>1); a *= a; if(t&1) a *= *this; return a; } //for prime mod mint inv() const { return pow(mod-2); } mint& operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint ret(*this); return ret /= a; } }; ostream &operator<<(ostream& os, const mint& x) { os << x.x; return os; } mint dp[305][90005]; int main(){ int N, d, K; cin >> N >> d >> K; dp[0][0] = 1; rep(i,N){ vector<mint> imos(90005, 0); rep(j,90005){ int a = j+1; int b = j+d+1; if(a<90005) imos[a] += dp[i][j]; if(b<90005) imos[b] -= dp[i][j]; } mint base(0); rep(j,90005){ base += imos[j]; dp[i+1][j] = base; } } cout << dp[N][K] << endl; return 0; }