結果
問題 | No.2318 Phys Bone Maker |
ユーザー | chro_96 |
提出日時 | 2023-05-27 07:34:39 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 458 ms / 3,000 ms |
コード長 | 2,425 bytes |
コンパイル時間 | 929 ms |
コンパイル使用メモリ | 32,320 KB |
実行使用メモリ | 236,928 KB |
最終ジャッジ日時 | 2024-06-07 13:13:59 |
合計ジャッジ時間 | 9,162 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 171 ms
236,928 KB |
testcase_01 | AC | 76 ms
236,928 KB |
testcase_02 | AC | 458 ms
236,924 KB |
testcase_03 | AC | 83 ms
236,920 KB |
testcase_04 | AC | 88 ms
236,924 KB |
testcase_05 | AC | 87 ms
236,800 KB |
testcase_06 | AC | 85 ms
236,928 KB |
testcase_07 | AC | 76 ms
236,928 KB |
testcase_08 | AC | 85 ms
236,916 KB |
testcase_09 | AC | 84 ms
236,928 KB |
testcase_10 | AC | 94 ms
236,908 KB |
testcase_11 | AC | 88 ms
236,800 KB |
testcase_12 | AC | 93 ms
236,928 KB |
testcase_13 | AC | 90 ms
236,800 KB |
testcase_14 | AC | 86 ms
236,928 KB |
testcase_15 | AC | 87 ms
236,928 KB |
testcase_16 | AC | 87 ms
236,832 KB |
testcase_17 | AC | 93 ms
236,928 KB |
testcase_18 | AC | 94 ms
236,928 KB |
testcase_19 | AC | 81 ms
236,832 KB |
testcase_20 | AC | 90 ms
236,928 KB |
testcase_21 | AC | 89 ms
236,928 KB |
testcase_22 | AC | 86 ms
236,800 KB |
testcase_23 | AC | 86 ms
236,928 KB |
testcase_24 | AC | 92 ms
236,800 KB |
testcase_25 | AC | 89 ms
236,812 KB |
testcase_26 | AC | 90 ms
236,800 KB |
testcase_27 | AC | 92 ms
236,928 KB |
testcase_28 | AC | 85 ms
236,836 KB |
testcase_29 | AC | 83 ms
236,928 KB |
testcase_30 | AC | 83 ms
236,836 KB |
testcase_31 | AC | 94 ms
236,792 KB |
testcase_32 | AC | 91 ms
236,796 KB |
testcase_33 | AC | 76 ms
236,800 KB |
testcase_34 | AC | 90 ms
236,800 KB |
testcase_35 | AC | 122 ms
236,928 KB |
testcase_36 | AC | 257 ms
236,800 KB |
testcase_37 | AC | 260 ms
236,928 KB |
testcase_38 | AC | 267 ms
236,800 KB |
testcase_39 | AC | 359 ms
236,928 KB |
testcase_40 | AC | 353 ms
236,800 KB |
testcase_41 | AC | 398 ms
236,928 KB |
testcase_42 | AC | 398 ms
236,928 KB |
testcase_43 | AC | 96 ms
236,928 KB |
testcase_44 | AC | 131 ms
236,800 KB |
testcase_45 | AC | 127 ms
236,800 KB |
testcase_46 | AC | 404 ms
236,928 KB |
testcase_47 | AC | 94 ms
236,800 KB |
ソースコード
#include <stdio.h> long long gcd (long long a, long long b) { if (b <= 0LL) { return a; } return gcd(b, a%b); } int main () { long long n = 0LL; int res = 0; long long ans = 0LL; long long mod_num = 998244353LL; long long tmp = 0LL; long long pl[20] = {}; long long pc[20] = {}; int pcnt = 0; long long div[6720] = {}; int divcnt = 0; int *e[6720] = {}; long long *c[6720] = {}; int ecnt[6720] = {}; int e_arr[20000000] = {}; long long c_arr[20000000] = {}; int sum = 0; int divpcnt[6720][20] = {}; long long dp[6720] = {}; res = scanf("%lld", &n); tmp = n; for (long long p = 2LL; p*p <= n; p += 1LL) { if (tmp%p == 0LL) { pl[pcnt] = p; while (tmp%p == 0LL) { tmp /= p; pc[pcnt]++; } pcnt++; } if (n%p == 0LL) { div[divcnt] = p; divcnt++; } } if (tmp > 1LL) { pl[pcnt] = tmp; pc[pcnt] = 1; pcnt++; } if (divcnt <= 0) { printf("1\n"); return 0; } if (div[divcnt-1]*div[divcnt-1] == n) { for (int i = 0; i < divcnt-1; i++) { div[2*divcnt-2-i] = n/div[i]; } divcnt = 2*divcnt-1; } else { for (int i = 0; i < divcnt; i++) { div[2*divcnt-1-i] = n/div[i]; } divcnt *= 2; } div[divcnt] = n; divcnt++; for (int i = 0; i < divcnt; i++) { for (int j = 0; j < pcnt; j++) { long long tmp = div[i]; while (tmp%pl[j] == 0LL) { tmp /= pl[j]; divpcnt[i][j]++; } } } for (int i = 0; i < divcnt; i++) { e[i] = e_arr+sum; c[i] = c_arr+sum; for (int j = i+1; j < divcnt; j++) { if (div[j]%div[i] == 0LL) { e[i][ecnt[i]] = j; c[i][ecnt[i]] = 1LL; for (int k = 0; k < pcnt; k++) { if (divpcnt[i][k] == divpcnt[j][k]) { c[i][ecnt[i]] *= (long long)(divpcnt[i][k]+1); c[i][ecnt[i]] %= mod_num; } } ecnt[i]++; } } sum += ecnt[i]; } for (int i = 0; i < divcnt; i++) { dp[i] = 1LL; } while (dp[divcnt-1] > 0LL) { ans += dp[divcnt-1]%mod_num; for (int i = divcnt-1; i >= 0; i--) { if (dp[i] > 0LL) { dp[i] %= mod_num; for (int j = 0; j < ecnt[i]; j++) { dp[e[i][j]] += dp[i]*c[i][j]; } } dp[i] = 0LL; } } printf("%lld\n", ans%mod_num); return 0; }