結果
問題 | No.6 使いものにならないハッシュ |
ユーザー |
|
提出日時 | 2023-07-28 07:34:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 117 ms / 5,000 ms |
コード長 | 578 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 14,080 KB |
最終ジャッジ日時 | 2024-10-05 17:32:38 |
合計ジャッジ時間 | 4,386 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
ソースコード
N = 300000isprime = [True] * Nisprime[0] = isprime[1] = Falsefor i in range(2, int(N ** 0.5 + 1)):if not isprime[i]:continuefor j in range(i * i, N, i):isprime[j] = Falsek = int(input())n = int(input())p = []h = []for i in range(k, n + 1):if isprime[i]:p.append(i)h.append(i % 9)max_ = 0ans = 0le = len(p)tf = [False] * 9r = 0for l in range(le):while r < le and not tf[h[r]]:tf[h[r]] = Truer += 1if r - l >= max_:max_ = r - lans = p[l]tf[h[l]] = Falseprint(ans)