結果

問題 No.1791 Repeat Multiplication
ユーザー t98slidert98slider
提出日時 2023-07-29 04:20:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 221 ms / 3,000 ms
コード長 553 bytes
コンパイル時間 1,637 ms
コンパイル使用メモリ 164,616 KB
実行使用メモリ 26,624 KB
最終ジャッジ日時 2024-04-16 11:42:54
合計ジャッジ時間 7,475 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 19 ms
5,376 KB
testcase_09 AC 18 ms
5,376 KB
testcase_10 AC 17 ms
5,376 KB
testcase_11 AC 16 ms
5,376 KB
testcase_12 AC 10 ms
5,376 KB
testcase_13 AC 193 ms
24,832 KB
testcase_14 AC 196 ms
25,344 KB
testcase_15 AC 130 ms
19,456 KB
testcase_16 AC 123 ms
19,072 KB
testcase_17 AC 201 ms
26,112 KB
testcase_18 AC 154 ms
21,760 KB
testcase_19 AC 190 ms
24,448 KB
testcase_20 AC 137 ms
20,096 KB
testcase_21 AC 186 ms
24,320 KB
testcase_22 AC 214 ms
26,368 KB
testcase_23 AC 145 ms
20,352 KB
testcase_24 AC 197 ms
25,088 KB
testcase_25 AC 176 ms
23,424 KB
testcase_26 AC 199 ms
25,728 KB
testcase_27 AC 155 ms
21,632 KB
testcase_28 AC 216 ms
26,496 KB
testcase_29 AC 216 ms
26,496 KB
testcase_30 AC 216 ms
26,624 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 214 ms
26,624 KB
testcase_33 AC 216 ms
26,624 KB
testcase_34 AC 221 ms
26,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    unsigned int N, Q, x;
    cin >> N >> Q;
    vector<unsigned long long> dp(N + 1, 1), dp2(N + 1, 1);
    for(int i = N / 2; i >= 1; i--){
        for(int j = 2 * i; j <= N; j += i){
            dp[i] += dp[j];
        }
    }
    for(int i = 2, r = N / 2; i <= r; i++){
        for(int j = 2 * i; j <= N; j += i){
            dp2[j] += dp2[i];
        }
    }
    while(Q--){
        cin >> x;
        cout << dp2[x] * dp[x] << '\n';
    }
}
0