結果

問題 No.1186 長方形の敷き詰め
ユーザー sahiyasahiya
提出日時 2020-12-20 18:16:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 1,158 bytes
コンパイル時間 1,446 ms
コンパイル使用メモリ 111,544 KB
実行使用メモリ 11,436 KB
最終ジャッジ日時 2023-10-21 10:52:59
合計ジャッジ時間 2,455 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 6 ms
11,436 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 10 ms
11,436 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 3 ms
6,344 KB
testcase_18 AC 5 ms
10,440 KB
testcase_19 AC 5 ms
10,440 KB
testcase_20 AC 5 ms
10,440 KB
testcase_21 AC 4 ms
8,392 KB
testcase_22 AC 10 ms
11,436 KB
testcase_23 AC 7 ms
8,392 KB
testcase_24 AC 6 ms
10,440 KB
testcase_25 AC 4 ms
8,392 KB
testcase_26 AC 5 ms
10,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef bitset<16> BS;
struct edge {
    int to, cost, id;
};
const ll MOD = 998244353;
const ll INF = 1E18;
const int MAX_N = 1E+06;

ll dx[4] = { -1, 1, 0, 0 }, dy[4] = { 0, 0, -1, 1 };

ll N, M;

ll dp[MAX_N + 1];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N >> M;

    dp[0] = 1;
    for (int i = 1; i <= M; i++) {
        dp[i] = dp[i - 1];
        if (i - N >= 0) {
            dp[i] += dp[i - N];
            dp[i] %= MOD;
        }
    }

    // for (int i = 1; i <= M; i++) {

    //     cout << "i = " << i << ", dp = " << dp[i] << "\n";
    // }

    cout << (N == 1 ? 1 : dp[M]) << "\n";

    return 0;
}
0