結果
| 問題 | No.3687 Coprime Count |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-09-06 21:58:55 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1,314 ms / 2,000 ms |
| + 346µs | |
| コード長 | 666 bytes |
| 記録 | |
| コンパイル時間 | 1,376 ms |
| コンパイル使用メモリ | 96,080 KB |
| 実行使用メモリ | 240,128 KB |
| 最終ジャッジ日時 | 2026-09-06 21:59:16 |
| 合計ジャッジ時間 | 7,456 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
class Eratosthenes:
def __init__(self, n):
self.isPrime = [True]*(n+1)
self.isPrime[0], self.isPrime[1] = False, False
self.mobius = [1]*(n+1)
for i in range(2, n+1):
if self.isPrime[i]:
self.mobius[i] = -1
for j in range(i*2, n+1, i):
self.isPrime[j] = False
if j//i%i == 0:
self.mobius[j] = 0
else:
self.mobius[j] *= -1
N, M = map(int, input().split())
MIN = min(N, M)
E = Eratosthenes(MIN)
ans = 0
for n in range(1, MIN+1):
ans += (N//n)*(M//n)*E.mobius[n]
print(ans)
detteiuu