結果

問題 No.1068 #いろいろな色 / Red and Blue and more various colors (Hard)
ユーザー keijakkeijak
提出日時 2022-01-01 17:20:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 380 ms / 3,500 ms
コード長 455 bytes
コンパイル時間 5,086 ms
コンパイル使用メモリ 265,908 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2024-04-18 15:08:34
合計ジャッジ時間 12,441 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,820 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 11 ms
6,940 KB
testcase_04 AC 9 ms
6,940 KB
testcase_05 AC 10 ms
6,940 KB
testcase_06 AC 8 ms
6,940 KB
testcase_07 AC 8 ms
6,940 KB
testcase_08 AC 10 ms
6,940 KB
testcase_09 AC 12 ms
6,940 KB
testcase_10 AC 6 ms
6,940 KB
testcase_11 AC 7 ms
6,940 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 360 ms
14,848 KB
testcase_14 AC 380 ms
14,720 KB
testcase_15 AC 372 ms
14,848 KB
testcase_16 AC 372 ms
14,848 KB
testcase_17 AC 364 ms
14,848 KB
testcase_18 AC 378 ms
14,848 KB
testcase_19 AC 373 ms
14,848 KB
testcase_20 AC 366 ms
14,848 KB
testcase_21 AC 367 ms
14,848 KB
testcase_22 AC 360 ms
14,848 KB
testcase_23 AC 363 ms
14,848 KB
testcase_24 AC 369 ms
14,720 KB
testcase_25 AC 362 ms
14,976 KB
testcase_26 AC 368 ms
14,720 KB
testcase_27 AC 366 ms
14,720 KB
testcase_28 AC 375 ms
14,848 KB
testcase_29 AC 323 ms
14,848 KB
testcase_30 AC 329 ms
14,976 KB
testcase_31 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using Mint=atcoder::modint998244353;
int main(){
  int N,Q;cin>>N>>Q;
  deque<vector<Mint>>q;
  for (long long i=0,a;i<N;++i)cin>>a,q.push_back(vector<Mint>{a-1,1});
  while(q.size()>1){
    auto r=atcoder::convolution(q[0],q[1]);
    if(r.size()>N+1)r.resize(N+1);
    q.pop_front();q.pop_front();q.push_back(r);
  }
  for (int i=0,b;i<Q;++i)cin>>b,printf("%u\n",q.front()[b].val());
}
0