結果

問題 No.732 3PrimeCounting
ユーザー ああいいああいい
提出日時 2022-02-23 18:17:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,645 ms / 3,000 ms
コード長 937 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 90,596 KB
最終ジャッジ日時 2023-09-14 11:13:16
合計ジャッジ時間 37,973 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,480 KB
testcase_01 AC 69 ms
71,492 KB
testcase_02 AC 69 ms
71,220 KB
testcase_03 AC 69 ms
71,324 KB
testcase_04 AC 75 ms
71,424 KB
testcase_05 AC 71 ms
71,444 KB
testcase_06 AC 70 ms
71,208 KB
testcase_07 AC 70 ms
71,480 KB
testcase_08 AC 69 ms
71,184 KB
testcase_09 AC 70 ms
71,448 KB
testcase_10 AC 70 ms
71,256 KB
testcase_11 AC 69 ms
71,432 KB
testcase_12 AC 69 ms
71,320 KB
testcase_13 AC 70 ms
71,348 KB
testcase_14 AC 71 ms
71,320 KB
testcase_15 AC 69 ms
71,256 KB
testcase_16 AC 69 ms
71,456 KB
testcase_17 AC 70 ms
71,208 KB
testcase_18 AC 68 ms
71,068 KB
testcase_19 AC 69 ms
71,404 KB
testcase_20 AC 81 ms
75,800 KB
testcase_21 AC 90 ms
76,848 KB
testcase_22 AC 90 ms
76,752 KB
testcase_23 AC 73 ms
75,832 KB
testcase_24 AC 74 ms
75,996 KB
testcase_25 AC 103 ms
77,380 KB
testcase_26 AC 98 ms
77,564 KB
testcase_27 AC 81 ms
76,348 KB
testcase_28 AC 83 ms
76,532 KB
testcase_29 AC 89 ms
76,412 KB
testcase_30 AC 89 ms
76,520 KB
testcase_31 AC 92 ms
76,668 KB
testcase_32 AC 102 ms
77,060 KB
testcase_33 AC 100 ms
77,616 KB
testcase_34 AC 101 ms
77,280 KB
testcase_35 AC 99 ms
77,216 KB
testcase_36 AC 99 ms
77,168 KB
testcase_37 AC 77 ms
75,848 KB
testcase_38 AC 76 ms
75,804 KB
testcase_39 AC 98 ms
77,452 KB
testcase_40 AC 94 ms
76,780 KB
testcase_41 AC 92 ms
76,976 KB
testcase_42 AC 94 ms
76,716 KB
testcase_43 AC 91 ms
76,724 KB
testcase_44 AC 90 ms
76,716 KB
testcase_45 AC 84 ms
76,400 KB
testcase_46 AC 84 ms
76,668 KB
testcase_47 AC 86 ms
76,552 KB
testcase_48 AC 107 ms
77,244 KB
testcase_49 AC 110 ms
77,408 KB
testcase_50 AC 90 ms
76,700 KB
testcase_51 AC 90 ms
76,752 KB
testcase_52 AC 83 ms
76,536 KB
testcase_53 AC 131 ms
78,352 KB
testcase_54 AC 915 ms
84,648 KB
testcase_55 AC 913 ms
84,568 KB
testcase_56 AC 913 ms
84,476 KB
testcase_57 AC 223 ms
79,356 KB
testcase_58 AC 226 ms
79,612 KB
testcase_59 AC 136 ms
78,428 KB
testcase_60 AC 303 ms
80,176 KB
testcase_61 AC 299 ms
80,076 KB
testcase_62 AC 1,193 ms
85,512 KB
testcase_63 AC 529 ms
82,316 KB
testcase_64 AC 379 ms
80,700 KB
testcase_65 AC 378 ms
80,760 KB
testcase_66 AC 74 ms
75,996 KB
testcase_67 AC 74 ms
75,772 KB
testcase_68 AC 1,042 ms
85,224 KB
testcase_69 AC 1,046 ms
85,256 KB
testcase_70 AC 938 ms
84,676 KB
testcase_71 AC 936 ms
84,536 KB
testcase_72 AC 498 ms
81,800 KB
testcase_73 AC 1,937 ms
88,684 KB
testcase_74 AC 1,943 ms
88,840 KB
testcase_75 AC 105 ms
77,468 KB
testcase_76 AC 1,019 ms
85,364 KB
testcase_77 AC 240 ms
79,648 KB
testcase_78 AC 1,492 ms
86,936 KB
testcase_79 AC 1,055 ms
85,264 KB
testcase_80 AC 1,347 ms
86,412 KB
testcase_81 AC 948 ms
84,696 KB
testcase_82 AC 80 ms
75,908 KB
testcase_83 AC 232 ms
79,424 KB
testcase_84 AC 254 ms
79,868 KB
testcase_85 AC 789 ms
84,044 KB
testcase_86 AC 1,371 ms
86,496 KB
testcase_87 AC 2,643 ms
90,596 KB
testcase_88 AC 2,645 ms
90,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
p1 = []
p2 = []
p = set()
C = 3 * N+1
dat = [0] * C
for i in range(2,C,2):
    dat[i] = 1
for i in range(3,C):
    if dat[i] == 0:
        if i <= N:
            if i % 3 == 1:
                p1.append(i)
            elif i % 3 == 2:
                p2.append(i)
        p.add(i)
        for j in range(i * 2,C,i):
            dat[j] = 1
dat = [0] * (2 * N)
for i in range(len(p1)):
    for j in range(i + 1,len(p1)):
        dat[p1[i]+p1[j]] += 1
dat2 = [0] * C
for i in p2:
    for j in range(20,2 * N,3):
        dat2[j+i] += dat[j]
for j in range(20,2 * N,3):
    dat2[j+3] += dat[j]
ans = 0
for v in p:
    ans += dat2[v]
dat = [0] * (2 * N)
dat2 = [0] * C
for i in range(len(p2)):
    for j in range(i + 1,len(p2)):
        dat[p2[i]+p2[j]] += 1
for i in p1:
    for j in range(16,2 * N,3):
        dat2[i+j] += dat[j]
for j in range(16,2 * N,3):
    dat2[j+3] += dat[j]
for v in p:
    ans += dat2[v]
print(ans)
0