結果

問題 No.9005 実行時間/使用メモリテスト(テスト用)
ユーザー はむ吉🐹
提出日時 2016-08-24 11:54:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,960 ms / 3,000 ms
コード長 538 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,304 KB
最終ジャッジ日時 2024-11-08 01:50:33
合計ジャッジ時間 18,892 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3

import array


N = 5000000


def sieve_of_eratosthenes(end, typecode="L"):
    assert end > 1
    is_prime = array.array("B", (True for i in range(end)))
    is_prime[0] = False
    is_prime[1] = False
    primes = array.array(typecode)
    for i in range(2, end):
        if is_prime[i]:
            primes.append(i)
            for j in range(2 * i, end, i):
                is_prime[j] = False
    return primes


def main():
    _ = sieve_of_eratosthenes(N)
    print(0)


if __name__ == '__main__':
    main()
0