結果
問題 | No.2318 Phys Bone Maker |
ユーザー | chro_96 |
提出日時 | 2023-05-27 00:35:24 |
言語 | C (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,405 bytes |
コンパイル時間 | 907 ms |
コンパイル使用メモリ | 31,428 KB |
実行使用メモリ | 237,056 KB |
最終ジャッジ日時 | 2024-06-07 09:53:57 |
合計ジャッジ時間 | 8,343 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 62 ms
236,928 KB |
testcase_01 | AC | 61 ms
236,928 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 76 ms
236,928 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 69 ms
236,816 KB |
testcase_30 | AC | 68 ms
236,928 KB |
testcase_31 | WA | - |
testcase_32 | AC | 77 ms
236,928 KB |
testcase_33 | AC | 60 ms
236,800 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | AC | 80 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]++; } } } for (int i = 0; i < divcnt; i++) { dp[i] = 1LL; } while (dp[divcnt-1] > 0LL) { ans += dp[divcnt-1]; for (int i = divcnt-1; i >= 0; i--) { if (dp[i] > 0LL) { for (int j = 0; j < ecnt[i]; j++) { dp[e[i][j]] += dp[i]*c[i][j]; dp[e[i][j]] %= mod_num; } } dp[i] = 0LL; } } printf("%lld\n", ans%mod_num); return 0; }