結果

問題 No.1839 Concatenation Matrix
ユーザー 👑 NachiaNachia
提出日時 2022-02-11 22:16:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 113 ms / 3,500 ms
コード長 1,138 bytes
コンパイル時間 2,157 ms
コンパイル使用メモリ 117,356 KB
実行使用メモリ 7,264 KB
最終ジャッジ日時 2023-09-10 03:34:10
合計ジャッジ時間 4,851 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 28 ms
4,376 KB
testcase_11 AC 113 ms
7,160 KB
testcase_12 AC 113 ms
7,204 KB
testcase_13 AC 112 ms
7,180 KB
testcase_14 AC 112 ms
7,264 KB
testcase_15 AC 112 ms
7,032 KB
testcase_16 AC 78 ms
5,196 KB
testcase_17 AC 82 ms
5,384 KB
testcase_18 AC 99 ms
6,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
#include <atcoder/convolution>
using namespace std;


using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned int;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using modint = atcoder::static_modint<998244353>;


vector<modint> powof10;
vector<modint> f(int n, int x){
    if(n == 0) return {1};
    if(n == 1) return {1,powof10[x+1]};
    vector<modint> L = f(n/2, x);
    vector<modint> R = f((n+1)/2, x+n/2);
    return atcoder::convolution(L,R);
}


int main() {
    int N; cin >> N;
    powof10.assign(N+1, 10);
    powof10[0] = 1;
    for(int i=2; i<=N; i++) powof10[i] = powof10[i-1] * powof10[i-1];

    auto res = f(N-1, 0);

    vector<modint> A(N+1,0);
    rep(i,N){ u32 a; cin >> a; A[i+1] = a; }
    A = atcoder::convolution(A, res);
    rep(i,N) A[i] += A[N+i];
    A.resize(N); 
    
    rep(i,N) cout << A[i].val() << '\n';
    return 0;
}




struct ios_do_not_sync{
    ios_do_not_sync(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
0