結果

問題 No.1011 Infinite Stairs
ユーザー sima.tettekesima.tetteke
提出日時 2020-03-21 04:55:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,684 bytes
コンパイル時間 1,707 ms
コンパイル使用メモリ 170,564 KB
実行使用メモリ 483,296 KB
最終ジャッジ日時 2023-08-22 13:29:18
合計ジャッジ時間 13,550 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 347 ms
483,040 KB
testcase_01 AC 345 ms
482,960 KB
testcase_02 AC 351 ms
482,956 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 360 ms
483,008 KB
testcase_06 AC 343 ms
483,124 KB
testcase_07 AC 347 ms
483,296 KB
testcase_08 AC 345 ms
483,272 KB
testcase_09 AC 344 ms
482,992 KB
testcase_10 WA -
testcase_11 AC 393 ms
483,288 KB
testcase_12 AC 348 ms
482,928 KB
testcase_13 WA -
testcase_14 AC 344 ms
483,116 KB
testcase_15 WA -
testcase_16 AC 427 ms
482,972 KB
testcase_17 WA -
testcase_18 AC 361 ms
483,056 KB
testcase_19 AC 343 ms
483,244 KB
testcase_20 AC 342 ms
483,008 KB
testcase_21 AC 367 ms
483,268 KB
testcase_22 WA -
testcase_23 AC 361 ms
483,076 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 356 ms
482,968 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:25:17: 警告: ‘t_e’ may be used uninitialized [-Wmaybe-uninitialized]
   25 |         ll t_s, t_e;
      |                 ^~~
main.cpp:25:12: 警告: ‘t_s’ may be used uninitialized [-Wmaybe-uninitialized]
   25 |         ll t_s, t_e;
      |            ^~~

ソースコード

diff #

#include "bits/stdc++.h"
 
using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main(){

    ll N, d, K;
    cin >> N >> d >> K;
    //Nと段数
    vector<vector<ll > > dp(319, vector<ll >(191919, 0));
    dp[0][0] = 1;
    ll s = 0;
    ll e = 1;

    for(ll i = 0; i < N; i++){
        //5
        //cout << i << endl;
        ll t_s, t_e;
        for(ll j = s; j < e; j++){
            for(ll h = 1; h <= d; h++){
                //cout << "yes" << endl;
                if(j + h + (N-i-1) * d < K) continue;
                else{
                    dp[i+1][j+h] += dp[i][j];
                    if(j == s) t_s = j + h;
                    break;
                }
                
            }
            if(j+1+d > K) continue;
            dp[i+1][j+1+d] += -dp[i][j];
            t_e = j + 1 + d;
            //cout << t_e << " ";
        }
        //cout << endl;
        //累積和
        // for(ll i = 0; i <= N; i++){
        //     for(ll j = 0; j <= K; j++){
        //         cout << dp[i][j] << " ";
        //     }
        //     cout << endl;
        // }
        // cout << endl;

        s = t_s;
        e = t_e;
        //cout << s << " " << e << endl;
        for(ll j = s; j <= e; j++){
            dp[i+1][j] += dp[i+1][j-1];
            dp[i+1][j] %= MOD;
        }
        //cout << endl;
    }

    // for(ll i = 0; i <= N; i++){
    //     for(ll j = 0; j <= K; j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    cout << dp[N][K] << endl;

}
0