結果

問題 No.2211 Frequency Table of GCD
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-13 11:56:11
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 900 bytes
コンパイル時間 5,697 ms
コンパイル使用メモリ 305,472 KB
実行使用メモリ 5,548 KB
最終ジャッジ日時 2023-10-13 01:03:16
合計ジャッジ時間 9,454 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 58 ms
5,172 KB
testcase_04 AC 72 ms
4,668 KB
testcase_05 AC 95 ms
4,868 KB
testcase_06 AC 77 ms
4,932 KB
testcase_07 AC 105 ms
5,284 KB
testcase_08 AC 13 ms
4,348 KB
testcase_09 AC 10 ms
4,348 KB
testcase_10 AC 25 ms
4,348 KB
testcase_11 AC 19 ms
4,352 KB
testcase_12 AC 28 ms
4,352 KB
testcase_13 AC 66 ms
4,664 KB
testcase_14 AC 82 ms
5,192 KB
testcase_15 AC 69 ms
5,132 KB
testcase_16 AC 79 ms
5,256 KB
testcase_17 AC 91 ms
4,920 KB
testcase_18 AC 133 ms
5,412 KB
testcase_19 AC 132 ms
5,452 KB
testcase_20 AC 134 ms
5,464 KB
testcase_21 AC 134 ms
5,548 KB
testcase_22 AC 132 ms
5,500 KB
testcase_23 AC 63 ms
5,440 KB
testcase_24 AC 119 ms
5,448 KB
testcase_25 AC 28 ms
4,352 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 AC 130 ms
5,440 KB
testcase_28 AC 122 ms
5,448 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