結果

問題 No.9005 実行時間/使用メモリテスト(テスト用)
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-08-24 11:54:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,555 ms / 3,000 ms
コード長 538 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 18,432 KB
最終ジャッジ日時 2024-04-25 14:53:12
合計ジャッジ時間 16,078 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,529 ms
18,304 KB
testcase_01 AC 2,555 ms
18,176 KB
testcase_02 AC 2,523 ms
18,304 KB
testcase_03 AC 2,492 ms
18,432 KB
testcase_04 AC 2,532 ms
18,432 KB
権限があれば一括ダウンロードができます

ソースコード

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