結果
| 問題 |
No.1839 Concatenation Matrix
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2022-02-11 22:16:43 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 122 ms / 3,500 ms |
| コード長 | 1,138 bytes |
| コンパイル時間 | 2,397 ms |
| コンパイル使用メモリ | 113,724 KB |
| 最終ジャッジ日時 | 2025-01-27 21:44:33 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#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;
Nachia