結果

問題 No.719 Coprime
ユーザー ああいいああいい
提出日時 2022-03-31 10:14:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 588 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,480 KB
実行使用メモリ 65,416 KB
最終ジャッジ日時 2024-04-28 03:37:26
合計ジャッジ時間 5,016 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
60,192 KB
testcase_01 AC 48 ms
59,556 KB
testcase_02 AC 49 ms
60,252 KB
testcase_03 AC 49 ms
59,904 KB
testcase_04 AC 49 ms
59,356 KB
testcase_05 AC 49 ms
59,948 KB
testcase_06 AC 49 ms
59,632 KB
testcase_07 AC 49 ms
59,440 KB
testcase_08 AC 49 ms
60,668 KB
testcase_09 AC 49 ms
59,800 KB
testcase_10 AC 49 ms
60,576 KB
testcase_11 AC 49 ms
60,168 KB
testcase_12 AC 50 ms
60,040 KB
testcase_13 AC 50 ms
61,408 KB
testcase_14 AC 50 ms
61,104 KB
testcase_15 AC 50 ms
60,840 KB
testcase_16 AC 50 ms
61,432 KB
testcase_17 AC 48 ms
61,040 KB
testcase_18 AC 49 ms
60,944 KB
testcase_19 AC 51 ms
60,872 KB
testcase_20 AC 50 ms
61,600 KB
testcase_21 AC 48 ms
59,804 KB
testcase_22 AC 50 ms
61,956 KB
testcase_23 AC 49 ms
61,840 KB
testcase_24 AC 50 ms
60,928 KB
testcase_25 AC 49 ms
59,984 KB
testcase_26 AC 49 ms
60,992 KB
testcase_27 AC 51 ms
60,204 KB
testcase_28 AC 50 ms
61,812 KB
testcase_29 AC 49 ms
60,300 KB
testcase_30 AC 49 ms
59,804 KB
testcase_31 AC 50 ms
60,752 KB
testcase_32 AC 49 ms
59,484 KB
testcase_33 AC 50 ms
60,748 KB
testcase_34 AC 50 ms
59,860 KB
testcase_35 AC 50 ms
60,384 KB
testcase_36 AC 48 ms
60,204 KB
testcase_37 AC 49 ms
60,816 KB
testcase_38 AC 49 ms
60,688 KB
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 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

prime = [2,3,5,7,11,13,17,19,23,29,31,37]
n = len(prime)

ans = 0
dat = list(range(N+1))
dat2 = [0] * (N + 1)
for i in range(n):
    p = prime[i]
    for j in range(p,N+1,p):
        while dat[j] % p == 0:
            dat[j] //= p
        dat2[j] |= 1 << i
for j in range(2,N+1):
    if dat[j] == j:
        ans += j
dp = [0] * (1 << n)
for j in range(2,N+1):
    dp[dat2[j]] = j
for bit in range(1,1 << n):
    T = bit
    while T:
        T -= 1
        T &= bit
        if dp[bit] < dp[T] + dp[bit ^ T]:
            dp[bit] = dp[T] + dp[bit ^ T]
print(ans + max(dp))
0