結果
問題 | 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,306 ms / 3,000 ms |
コード長 | 761 bytes |
コンパイル時間 | 291 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 86,468 KB |
最終ジャッジ日時 | 2024-05-08 23:54:36 |
合計ジャッジ時間 | 62,626 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 513 ms
43,968 KB |
testcase_01 | AC | 509 ms
44,384 KB |
testcase_02 | AC | 508 ms
44,480 KB |
testcase_03 | AC | 510 ms
44,220 KB |
testcase_04 | AC | 507 ms
44,348 KB |
testcase_05 | AC | 507 ms
43,968 KB |
testcase_06 | AC | 510 ms
44,224 KB |
testcase_07 | AC | 516 ms
44,504 KB |
testcase_08 | AC | 510 ms
44,476 KB |
testcase_09 | AC | 508 ms
43,976 KB |
testcase_10 | AC | 506 ms
44,352 KB |
testcase_11 | AC | 509 ms
44,476 KB |
testcase_12 | AC | 506 ms
44,604 KB |
testcase_13 | AC | 509 ms
44,352 KB |
testcase_14 | AC | 506 ms
44,604 KB |
testcase_15 | AC | 511 ms
44,572 KB |
testcase_16 | AC | 506 ms
43,840 KB |
testcase_17 | AC | 507 ms
43,840 KB |
testcase_18 | AC | 506 ms
44,092 KB |
testcase_19 | AC | 507 ms
44,480 KB |
testcase_20 | AC | 511 ms
44,480 KB |
testcase_21 | AC | 519 ms
44,484 KB |
testcase_22 | AC | 559 ms
43,964 KB |
testcase_23 | AC | 548 ms
44,608 KB |
testcase_24 | AC | 518 ms
44,352 KB |
testcase_25 | AC | 532 ms
44,360 KB |
testcase_26 | AC | 535 ms
44,356 KB |
testcase_27 | AC | 515 ms
44,356 KB |
testcase_28 | AC | 509 ms
43,972 KB |
testcase_29 | AC | 519 ms
44,076 KB |
testcase_30 | AC | 519 ms
44,484 KB |
testcase_31 | AC | 518 ms
44,352 KB |
testcase_32 | AC | 562 ms
44,356 KB |
testcase_33 | AC | 539 ms
43,968 KB |
testcase_34 | AC | 531 ms
44,360 KB |
testcase_35 | AC | 522 ms
44,352 KB |
testcase_36 | AC | 531 ms
44,352 KB |
testcase_37 | AC | 510 ms
43,972 KB |
testcase_38 | AC | 511 ms
44,352 KB |
testcase_39 | AC | 528 ms
44,004 KB |
testcase_40 | AC | 522 ms
44,100 KB |
testcase_41 | AC | 520 ms
44,608 KB |
testcase_42 | AC | 518 ms
44,480 KB |
testcase_43 | AC | 524 ms
44,224 KB |
testcase_44 | AC | 520 ms
44,356 KB |
testcase_45 | AC | 516 ms
44,352 KB |
testcase_46 | AC | 518 ms
44,096 KB |
testcase_47 | AC | 521 ms
43,880 KB |
testcase_48 | AC | 533 ms
44,224 KB |
testcase_49 | AC | 535 ms
43,980 KB |
testcase_50 | AC | 520 ms
43,964 KB |
testcase_51 | AC | 521 ms
44,608 KB |
testcase_52 | AC | 510 ms
43,964 KB |
testcase_53 | AC | 550 ms
45,420 KB |
testcase_54 | AC | 898 ms
64,800 KB |
testcase_55 | AC | 916 ms
65,036 KB |
testcase_56 | AC | 922 ms
64,856 KB |
testcase_57 | AC | 612 ms
48,676 KB |
testcase_58 | AC | 618 ms
49,060 KB |
testcase_59 | AC | 563 ms
45,044 KB |
testcase_60 | AC | 709 ms
54,224 KB |
testcase_61 | AC | 712 ms
54,612 KB |
testcase_62 | AC | 910 ms
65,048 KB |
testcase_63 | AC | 703 ms
54,920 KB |
testcase_64 | AC | 700 ms
54,540 KB |
testcase_65 | AC | 702 ms
54,540 KB |
testcase_66 | AC | 510 ms
44,604 KB |
testcase_67 | AC | 510 ms
44,228 KB |
testcase_68 | AC | 905 ms
65,356 KB |
testcase_69 | AC | 907 ms
65,220 KB |
testcase_70 | AC | 890 ms
65,556 KB |
testcase_71 | AC | 900 ms
64,796 KB |
testcase_72 | AC | 758 ms
54,400 KB |
testcase_73 | AC | 908 ms
65,868 KB |
testcase_74 | AC | 909 ms
65,180 KB |
testcase_75 | AC | 531 ms
44,236 KB |
testcase_76 | AC | 904 ms
65,592 KB |
testcase_77 | AC | 603 ms
48,440 KB |
testcase_78 | AC | 903 ms
65,572 KB |
testcase_79 | AC | 919 ms
65,628 KB |
testcase_80 | AC | 934 ms
65,612 KB |
testcase_81 | AC | 918 ms
65,152 KB |
testcase_82 | AC | 517 ms
44,080 KB |
testcase_83 | AC | 612 ms
48,684 KB |
testcase_84 | AC | 717 ms
54,292 KB |
testcase_85 | AC | 916 ms
64,828 KB |
testcase_86 | AC | 913 ms
65,092 KB |
testcase_87 | AC | 1,304 ms
85,732 KB |
testcase_88 | AC | 1,306 ms
86,468 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()