結果

問題 No.1839 Concatenation Matrix
ユーザー 👑 hitonanodehitonanode
提出日時 2021-12-19 18:04:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 894 bytes
コンパイル時間 2,574 ms
コンパイル使用メモリ 93,268 KB
実行使用メモリ 8,764 KB
最終ジャッジ日時 2023-10-13 18:56:22
合計ジャッジ時間 7,769 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,764 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 7 ms
4,352 KB
testcase_09 AC 14 ms
4,348 KB
testcase_10 AC 1,206 ms
4,348 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 愚直 O(n^2)
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <iostream>
#include <vector>
using namespace std;

// #include <atcoder/modint>
// using mint = atcoder::modint998244353;

constexpr unsigned md = 998244353;

int main() {
    cin.tie(nullptr), ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<unsigned> A(N), B(N + 1);
    for (auto &a : A) {
        int x;
        cin >> x;
        a = x;
    }
    A.push_back(0);
    unsigned base = 10;
    for (int iter = 0; iter < N - 1; ++iter) {
        A[N] = A[0];
        for (int i = 0; i < N; ++i) {
            // B[i] = A[i] * base + A[i + 1];
            B[i] = ((unsigned long long)A[i] * base + A[i + 1]) % md;
        }
        swap(A, B);
        base = (unsigned long long)base * base % md;
    }

    A.pop_back();
    for (auto a : A) cout << a << '\n';
}
0