結果

問題 No.2211 Frequency Table of GCD
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-13 11:56:11
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 900 bytes
コンパイル時間 5,481 ms
コンパイル使用メモリ 310,160 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 22:55:13
合計ジャッジ時間 9,292 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 AC 60 ms
6,944 KB
testcase_04 AC 75 ms
6,940 KB
testcase_05 AC 102 ms
6,940 KB
testcase_06 AC 81 ms
6,944 KB
testcase_07 AC 108 ms
6,944 KB
testcase_08 AC 15 ms
6,940 KB
testcase_09 AC 10 ms
6,940 KB
testcase_10 AC 28 ms
6,944 KB
testcase_11 AC 22 ms
6,944 KB
testcase_12 AC 32 ms
6,944 KB
testcase_13 AC 68 ms
6,944 KB
testcase_14 AC 84 ms
6,944 KB
testcase_15 AC 72 ms
6,940 KB
testcase_16 AC 81 ms
6,940 KB
testcase_17 AC 95 ms
6,940 KB
testcase_18 AC 138 ms
6,940 KB
testcase_19 AC 139 ms
6,944 KB
testcase_20 AC 139 ms
6,944 KB
testcase_21 AC 139 ms
6,940 KB
testcase_22 AC 140 ms
6,944 KB
testcase_23 AC 66 ms
6,940 KB
testcase_24 AC 126 ms
6,944 KB
testcase_25 AC 31 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 138 ms
6,944 KB
testcase_28 AC 126 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define db double
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
ll mod=998244353;
ll mpow(ll a,ll t){
	if(t==0)return 1;
	ll res=mpow(a,t/2);
	res=res*res%mod;
	if(t&1)res*=a;
	return res%mod;
}
int main(){
	int n,m;cin>>n>>m;
	vc<int>v(m+1,0);
	rep(i,n){
		int a;cin>>a;
		v[a]++;
	}
	vc<ll>x(m+1,0);
	for(int i=m;i>=1;i--){
		for(int j=i;j<=m;j+=i)x[i]+=v[j];
		x[i]=mpow((ll)2,x[i])-1;
		x[i]=(x[i]+mod)%mod;
		for(int j=i*2;j<=m;j+=i){
			x[i]-=x[j];
			x[i]+=mod;
			x[i]%=mod;
		}
	}
	for(int i=1;i<=m;i++)cout<<x[i]<<"\n";
}
	
0