結果
問題 | No.2211 Frequency Table of GCD |
ユーザー | kabipoyo |
提出日時 | 2023-02-10 22:34:01 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,366 ms / 2,000 ms |
コード長 | 1,552 bytes |
コンパイル時間 | 5,254 ms |
コンパイル使用メモリ | 265,024 KB |
実行使用メモリ | 5,468 KB |
最終ジャッジ日時 | 2023-09-22 01:13:54 |
合計ジャッジ時間 | 21,093 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 255 ms
4,376 KB |
testcase_04 | AC | 467 ms
4,380 KB |
testcase_05 | AC | 692 ms
4,760 KB |
testcase_06 | AC | 470 ms
4,388 KB |
testcase_07 | AC | 718 ms
4,836 KB |
testcase_08 | AC | 26 ms
4,376 KB |
testcase_09 | AC | 20 ms
4,376 KB |
testcase_10 | AC | 59 ms
4,380 KB |
testcase_11 | AC | 40 ms
4,376 KB |
testcase_12 | AC | 64 ms
4,416 KB |
testcase_13 | AC | 419 ms
4,376 KB |
testcase_14 | AC | 475 ms
4,376 KB |
testcase_15 | AC | 373 ms
4,376 KB |
testcase_16 | AC | 448 ms
4,380 KB |
testcase_17 | AC | 635 ms
4,488 KB |
testcase_18 | AC | 1,027 ms
5,412 KB |
testcase_19 | AC | 1,023 ms
5,380 KB |
testcase_20 | AC | 1,013 ms
5,408 KB |
testcase_21 | AC | 1,018 ms
5,468 KB |
testcase_22 | AC | 1,013 ms
5,284 KB |
testcase_23 | AC | 268 ms
4,376 KB |
testcase_24 | AC | 1,366 ms
5,412 KB |
testcase_25 | AC | 38 ms
4,572 KB |
testcase_26 | AC | 2 ms
4,376 KB |
testcase_27 | AC | 1,010 ms
5,400 KB |
testcase_28 | AC | 1,359 ms
5,328 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; typedef int64_t lint; #define rep(i, n) for(int i=0; i<n; i++) #define repx(i, l, n) for(int i=l; i<n; i++) #define all(v) v.begin(), v.end() #define show(x) cout << #x << ": " << x << endl; #define list(x) cout << #x << ": " << x << " "; #define pb push_back using vi = vector<lint>; using vvi = vector<vector<lint>>; template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<class T> inline void drop(T x) { cout << x << endl; exit(0); } template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i).val() << ' '; } cout << endl; } constexpr lint LINF = LLONG_MAX/2; using mint = modint998244353; using vm = vector<mint>; vector<lint> divisor(lint n) { vector<lint> v; for (lint i = 1; i*i <= n; i++) { if (n % i == 0) { v.push_back(i); if (i*i != n) v.push_back(n/i); } } sort(v.begin(), v.end()); return v; } int main() { lint N, M; cin >> N >> M; vi v(N); vin(v); mint a=0, b=0, c=0; lint x, y, z; vm w(M+1); rep(i, N) { vi t = divisor(v[i]); rep(j, t.size()) { w[t[j]] *= 2; w[t[j]]++; } a *= 2; a++; // vout(w); } for (int i = M; i > 0; i--) { repx(j, 2, M+1) { if (i*j > M) break; w[i] -= w[i*j]; } } repx(i, 1, M+1) { cout << w[i].val() << endl; } }