結果

問題 No.1811 EQUIV Ten
ユーザー trineutrontrineutron
提出日時 2022-01-14 22:03:55
言語 C++23(draft)
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 684 bytes
コンパイル時間 2,586 ms
コンパイル使用メモリ 250,400 KB
実行使用メモリ 17,040 KB
最終ジャッジ日時 2023-08-12 19:44:31
合計ジャッジ時間 4,390 ms
ジャッジサーバーID
(参考情報)
judge14 / judge7
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 38 ms
14,660 KB
testcase_12 AC 39 ms
15,592 KB
testcase_13 AC 42 ms
16,648 KB
testcase_14 AC 45 ms
16,900 KB
testcase_15 AC 46 ms
17,040 KB
testcase_16 AC 1 ms
4,384 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 3 ms
4,384 KB
testcase_21 AC 3 ms
4,388 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 17 ms
7,896 KB
testcase_24 AC 4 ms
4,384 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 13 ms
7,136 KB
testcase_27 AC 2 ms
4,384 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 2 ms
4,384 KB
testcase_30 AC 38 ms
14,384 KB
testcase_31 AC 3 ms
4,384 KB
testcase_32 AC 4 ms
4,384 KB
testcase_33 AC 5 ms
4,400 KB
testcase_34 AC 37 ms
13,772 KB
testcase_35 AC 14 ms
6,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>

using namespace std;
using namespace atcoder;

using mint = modint1000000007;

int main()
{
    int n;
    cin >> n;
    mint ans = 0;
    vector dp(n + 1, vector<mint>(8));
    dp.at(0).at(0) = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            if (j == 5)
            {
                ans += dp.at(i).at(j) * mint(2).pow(n - i - 1);
            }
            else
            {
                dp.at(i + 1).at(2 * j % 8) += dp.at(i).at(j);
            }
            dp.at(i + 1).at((2 * j + 1) % 8) += dp.at(i).at(j);
        }
    }
    cout << ans.val() << endl;
    return 0;
}
0