結果
問題 |
No.1186 長方形の敷き詰め
|
ユーザー |
![]() |
提出日時 | 2020-12-20 18:16:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 1,158 bytes |
コンパイル時間 | 1,520 ms |
コンパイル使用メモリ | 110,996 KB |
実行使用メモリ | 11,324 KB |
最終ジャッジ日時 | 2024-09-21 12:02:02 |
合計ジャッジ時間 | 2,225 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#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; }