結果

問題 No.1791 Repeat Multiplication
ユーザー 👑 NachiaNachia
提出日時 2021-12-20 00:13:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 92 ms / 3,000 ms
コード長 736 bytes
コンパイル時間 675 ms
コンパイル使用メモリ 78,832 KB
実行使用メモリ 14,876 KB
最終ジャッジ日時 2023-10-13 19:14:14
合計ジャッジ時間 5,478 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 17 ms
4,352 KB
testcase_09 AC 16 ms
4,348 KB
testcase_10 AC 16 ms
4,348 KB
testcase_11 AC 13 ms
4,352 KB
testcase_12 AC 9 ms
4,352 KB
testcase_13 AC 84 ms
14,000 KB
testcase_14 AC 86 ms
14,064 KB
testcase_15 AC 62 ms
10,952 KB
testcase_16 AC 61 ms
10,948 KB
testcase_17 AC 92 ms
14,332 KB
testcase_18 AC 71 ms
12,212 KB
testcase_19 AC 87 ms
13,860 KB
testcase_20 AC 67 ms
11,556 KB
testcase_21 AC 85 ms
13,544 KB
testcase_22 AC 92 ms
14,644 KB
testcase_23 AC 67 ms
11,848 KB
testcase_24 AC 87 ms
14,068 KB
testcase_25 AC 79 ms
13,004 KB
testcase_26 AC 87 ms
14,276 KB
testcase_27 AC 72 ms
12,344 KB
testcase_28 AC 90 ms
14,840 KB
testcase_29 AC 89 ms
14,876 KB
testcase_30 AC 91 ms
14,600 KB
testcase_31 AC 1 ms
4,348 KB
testcase_32 AC 91 ms
14,644 KB
testcase_33 AC 90 ms
14,852 KB
testcase_34 AC 89 ms
14,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)

int N,Q;
vector<i64> dp1;


int main() {
    cin >> N >> Q;
    dp1.assign(N+1, 0);

    dp1[1] = 1;
    for(i64 i=1; i<=N; i++) for(i64 j=i*2; j<=N; j+=i) dp1[j] += dp1[i];
    for(i64 i=1; i<=N; i++) dp1[i] += dp1[i-1];

    rep(i,Q){
        int x; cin >> x;
        i64 ans = (dp1[x] - dp1[x-1]) * dp1[N/x];
        cout << ans << "\n";
    }
    return 0;
}


struct ios_do_not_sync{
    ios_do_not_sync(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
0