結果
問題 | No.732 3PrimeCounting |
ユーザー | Min_25 |
提出日時 | 2018-09-08 11:54:37 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,292 ms / 3,000 ms |
コード長 | 761 bytes |
コンパイル時間 | 172 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 87,700 KB |
最終ジャッジ日時 | 2024-12-15 07:54:37 |
合計ジャッジ時間 | 60,986 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 508 ms
44,100 KB |
testcase_01 | AC | 517 ms
43,972 KB |
testcase_02 | AC | 518 ms
44,104 KB |
testcase_03 | AC | 522 ms
44,100 KB |
testcase_04 | AC | 509 ms
44,736 KB |
testcase_05 | AC | 516 ms
44,360 KB |
testcase_06 | AC | 512 ms
43,968 KB |
testcase_07 | AC | 517 ms
44,484 KB |
testcase_08 | AC | 511 ms
44,220 KB |
testcase_09 | AC | 516 ms
44,352 KB |
testcase_10 | AC | 513 ms
44,600 KB |
testcase_11 | AC | 514 ms
44,356 KB |
testcase_12 | AC | 504 ms
44,476 KB |
testcase_13 | AC | 513 ms
44,356 KB |
testcase_14 | AC | 512 ms
43,840 KB |
testcase_15 | AC | 512 ms
44,236 KB |
testcase_16 | AC | 509 ms
44,352 KB |
testcase_17 | AC | 515 ms
44,100 KB |
testcase_18 | AC | 521 ms
44,484 KB |
testcase_19 | AC | 513 ms
44,092 KB |
testcase_20 | AC | 512 ms
44,484 KB |
testcase_21 | AC | 518 ms
44,480 KB |
testcase_22 | AC | 528 ms
44,352 KB |
testcase_23 | AC | 514 ms
44,348 KB |
testcase_24 | AC | 517 ms
44,100 KB |
testcase_25 | AC | 534 ms
43,972 KB |
testcase_26 | AC | 535 ms
43,968 KB |
testcase_27 | AC | 513 ms
44,220 KB |
testcase_28 | AC | 517 ms
43,840 KB |
testcase_29 | AC | 523 ms
44,608 KB |
testcase_30 | AC | 520 ms
43,964 KB |
testcase_31 | AC | 525 ms
44,228 KB |
testcase_32 | AC | 530 ms
44,104 KB |
testcase_33 | AC | 537 ms
44,356 KB |
testcase_34 | AC | 543 ms
44,608 KB |
testcase_35 | AC | 544 ms
44,096 KB |
testcase_36 | AC | 542 ms
44,480 KB |
testcase_37 | AC | 521 ms
44,100 KB |
testcase_38 | AC | 527 ms
44,228 KB |
testcase_39 | AC | 543 ms
44,232 KB |
testcase_40 | AC | 536 ms
43,972 KB |
testcase_41 | AC | 536 ms
44,352 KB |
testcase_42 | AC | 535 ms
44,096 KB |
testcase_43 | AC | 528 ms
44,348 KB |
testcase_44 | AC | 533 ms
43,964 KB |
testcase_45 | AC | 518 ms
44,352 KB |
testcase_46 | AC | 522 ms
44,352 KB |
testcase_47 | AC | 531 ms
44,092 KB |
testcase_48 | AC | 541 ms
44,092 KB |
testcase_49 | AC | 535 ms
44,228 KB |
testcase_50 | AC | 556 ms
44,480 KB |
testcase_51 | AC | 529 ms
44,348 KB |
testcase_52 | AC | 515 ms
43,976 KB |
testcase_53 | AC | 564 ms
45,432 KB |
testcase_54 | AC | 916 ms
65,040 KB |
testcase_55 | AC | 905 ms
65,164 KB |
testcase_56 | AC | 907 ms
66,768 KB |
testcase_57 | AC | 618 ms
48,928 KB |
testcase_58 | AC | 613 ms
48,696 KB |
testcase_59 | AC | 563 ms
45,288 KB |
testcase_60 | AC | 714 ms
54,092 KB |
testcase_61 | AC | 724 ms
54,608 KB |
testcase_62 | AC | 897 ms
66,304 KB |
testcase_63 | AC | 703 ms
54,420 KB |
testcase_64 | AC | 718 ms
54,296 KB |
testcase_65 | AC | 717 ms
54,040 KB |
testcase_66 | AC | 505 ms
43,968 KB |
testcase_67 | AC | 514 ms
44,224 KB |
testcase_68 | AC | 905 ms
64,908 KB |
testcase_69 | AC | 915 ms
64,848 KB |
testcase_70 | AC | 931 ms
64,792 KB |
testcase_71 | AC | 907 ms
65,040 KB |
testcase_72 | AC | 724 ms
54,260 KB |
testcase_73 | AC | 919 ms
65,404 KB |
testcase_74 | AC | 907 ms
65,144 KB |
testcase_75 | AC | 543 ms
44,068 KB |
testcase_76 | AC | 920 ms
65,212 KB |
testcase_77 | AC | 606 ms
49,072 KB |
testcase_78 | AC | 895 ms
65,084 KB |
testcase_79 | AC | 909 ms
64,844 KB |
testcase_80 | AC | 897 ms
66,928 KB |
testcase_81 | AC | 918 ms
64,856 KB |
testcase_82 | AC | 522 ms
43,968 KB |
testcase_83 | AC | 602 ms
48,692 KB |
testcase_84 | AC | 696 ms
54,664 KB |
testcase_85 | AC | 890 ms
65,028 KB |
testcase_86 | AC | 890 ms
65,216 KB |
testcase_87 | AC | 1,277 ms
86,968 KB |
testcase_88 | AC | 1,292 ms
87,700 KB |
ソースコード
import numpy as np def solve(): from sys import stdin from numpy.fft import fft, ifft for line in stdin: n = int(line) n3 = n * 3 isp = np.ones(n3 + 1, np.uint8) v = int(n3 ** 0.5) for i in range(2, v + 1): if isp[i]: isp[i*i::i] = 0 isp[0] = isp[1] = 0 s = 1 << (((n3 + 1) * 2 - 1).bit_length() - 1) f = np.zeros(s, np.complex128) f[:n+1] = isp[:n+1] ff, fg = fft(f), np.zeros(s, np.complex128) mask = s - 1 for i in range(s): p1, p2, p3 = ff[i], ff[(2 * i) & mask], ff[(3 * i) & mask] e1 = p1 e2 = (e1 * p1 - p2) / 2.0 e3 = (e2 * p1 - e1 * p2 + p3) / 3.0 fg[i] = e3 g = ifft(fg).real.round().astype(np.int64) print(np.sum(g[np.nonzero(isp)])) solve()