結果

問題 No.1754 T-block Tiling
ユーザー kpinkcatkpinkcat
提出日時 2023-09-15 12:05:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 1,999 ms
コンパイル使用メモリ 200,796 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-15 12:05:22
合計ジャッジ時間 2,413 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;

int main()
{
    ll n, max1 = -1, mod = 998244353;
    cin >> n;
    vector<ll> c(n);
    for (int i = 0; i < n; i++){
        cin >> c[i];
        max1 = max(max1, c[i]);
    }
    vector<ll> a(max1), sum(max1);
    a[0] = 2;
    sum[0] = 2;
    for (int i = 1; i < max1; i++){
        a[i] = (sum[i-1]*2 + 2)%mod;
        sum[i] = (sum[i-1] + a[i])%mod; 
    }
    for (int i = 0; i < n; i++){
        cout << a[c[i] - 1] << endl;
    }
}

0