結果

問題 No.2211 Frequency Table of GCD
ユーザー umezoumezo
提出日時 2023-02-10 23:05:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 201,720 KB
実行使用メモリ 7,012 KB
最終ジャッジ日時 2023-09-22 01:16:43
合計ジャッジ時間 4,884 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,400 KB
testcase_01 AC 4 ms
5,444 KB
testcase_02 AC 4 ms
5,420 KB
testcase_03 AC 26 ms
6,136 KB
testcase_04 AC 28 ms
6,128 KB
testcase_05 AC 36 ms
6,408 KB
testcase_06 AC 31 ms
6,668 KB
testcase_07 AC 40 ms
6,892 KB
testcase_08 AC 9 ms
5,612 KB
testcase_09 AC 7 ms
5,616 KB
testcase_10 AC 14 ms
5,860 KB
testcase_11 AC 12 ms
5,872 KB
testcase_12 AC 15 ms
5,924 KB
testcase_13 AC 26 ms
6,184 KB
testcase_14 AC 33 ms
6,456 KB
testcase_15 AC 30 ms
6,156 KB
testcase_16 AC 34 ms
6,136 KB
testcase_17 AC 35 ms
6,400 KB
testcase_18 AC 52 ms
7,008 KB
testcase_19 AC 48 ms
6,976 KB
testcase_20 AC 48 ms
7,012 KB
testcase_21 AC 50 ms
6,980 KB
testcase_22 AC 50 ms
6,916 KB
testcase_23 AC 30 ms
6,128 KB
testcase_24 AC 47 ms
6,928 KB
testcase_25 AC 17 ms
6,212 KB
testcase_26 AC 4 ms
5,404 KB
testcase_27 AC 46 ms
6,924 KB
testcase_28 AC 48 ms
6,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MOD=998244353;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  vector<ll> P(200200);
  P[0]=1;
  for(int i=1;i<200200;i++) P[i]=P[i-1]*2%MOD;
  
  int n,m;
  cin>>n>>m;
  vector<int> A(n);
  rep(i,n)cin>>A[i];
  
  vector<int> B(200200);
  rep(i,n) B[A[i]]++;
  
  vector<int> ANS(m+1);
  for(int i=m;i>=1;i--){
    ll a=0,b=0;
    for(int j=i;j<=m;j+=i){
      a=(a+B[j])%MOD;
      if(j!=i) b=(b+ANS[j])%MOD;
    }
    ANS[i]=(P[a]-1-b+MOD)%MOD;
  }
  for(int i=1;i<=m;i++) cout<<ANS[i]<<'\n';
  
  return 0;
}
0