結果

問題 No.2211 Frequency Table of GCD
ユーザー 沙耶花沙耶花
提出日時 2023-02-10 21:30:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 330 ms / 2,000 ms
コード長 648 bytes
コンパイル時間 4,364 ms
コンパイル使用メモリ 262,136 KB
実行使用メモリ 4,948 KB
最終ジャッジ日時 2023-09-22 00:58:09
合計ジャッジ時間 11,724 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,768 KB
testcase_01 AC 11 ms
4,664 KB
testcase_02 AC 11 ms
4,924 KB
testcase_03 AC 244 ms
4,596 KB
testcase_04 AC 207 ms
4,764 KB
testcase_05 AC 247 ms
4,616 KB
testcase_06 AC 241 ms
4,948 KB
testcase_07 AC 281 ms
4,732 KB
testcase_08 AC 22 ms
4,760 KB
testcase_09 AC 19 ms
4,620 KB
testcase_10 AC 35 ms
4,672 KB
testcase_11 AC 29 ms
4,712 KB
testcase_12 AC 37 ms
4,772 KB
testcase_13 AC 195 ms
4,588 KB
testcase_14 AC 265 ms
4,612 KB
testcase_15 AC 242 ms
4,616 KB
testcase_16 AC 256 ms
4,592 KB
testcase_17 AC 238 ms
4,616 KB
testcase_18 AC 329 ms
4,616 KB
testcase_19 AC 330 ms
4,660 KB
testcase_20 AC 326 ms
4,636 KB
testcase_21 AC 325 ms
4,636 KB
testcase_22 AC 317 ms
4,588 KB
testcase_23 AC 261 ms
4,624 KB
testcase_24 AC 320 ms
4,712 KB
testcase_25 AC 38 ms
4,772 KB
testcase_26 AC 11 ms
4,664 KB
testcase_27 AC 321 ms
4,708 KB
testcase_28 AC 321 ms
4,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001



int main(){
	
	int N,M;
	cin>>N>>M;
	
	vector<int> a(200005);
	rep(i,N){
		int x;
		cin>>x;
		a[x]++;
	}
	
	vector<mint> g(a.size());
	for(int i=1;i<=200000;i++){
		int c = 0;
		for(int j=i;j<=200000;j+=i)c += a[j];
		g[i] = mint(2).pow(c)-1;
	}
	
	for(int i=200000;i>=1;i--){
		for(int j=i*2;j<=200000;j+=i)g[i] -= g[j];
	}
	
	for(int i =1;i<=M;i++){
		cout<<g[i].val()<<endl;
	}
	
	return 0;
}
0