結果

問題 No.1653 Squarefree
ユーザー mkawa2mkawa2
提出日時 2023-02-19 12:58:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,064 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 251,092 KB
最終ジャッジ日時 2023-09-27 19:41:06
合計ジャッジ時間 42,342 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 257 ms
242,016 KB
testcase_02 AC 249 ms
243,056 KB
testcase_03 AC 280 ms
242,384 KB
testcase_04 AC 266 ms
242,100 KB
testcase_05 AC 269 ms
242,000 KB
testcase_06 AC 268 ms
242,972 KB
testcase_07 AC 257 ms
241,936 KB
testcase_08 AC 268 ms
242,868 KB
testcase_09 AC 255 ms
241,900 KB
testcase_10 AC 264 ms
242,032 KB
testcase_11 AC 822 ms
250,344 KB
testcase_12 AC 821 ms
250,144 KB
testcase_13 AC 1,380 ms
249,976 KB
testcase_14 AC 1,354 ms
250,164 KB
testcase_15 AC 1,357 ms
249,996 KB
testcase_16 AC 1,368 ms
250,252 KB
testcase_17 AC 1,366 ms
250,204 KB
testcase_18 AC 1,395 ms
250,232 KB
testcase_19 AC 1,417 ms
250,496 KB
testcase_20 AC 1,415 ms
250,756 KB
testcase_21 AC 1,446 ms
251,092 KB
testcase_22 AC 1,390 ms
250,176 KB
testcase_23 AC 1,375 ms
250,132 KB
testcase_24 WA -
testcase_25 AC 1,428 ms
250,264 KB
testcase_26 AC 1,400 ms
250,760 KB
testcase_27 AC 1,447 ms
250,128 KB
testcase_28 AC 1,387 ms
250,180 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1,339 ms
250,276 KB
testcase_32 AC 1,352 ms
250,536 KB
testcase_33 WA -
testcase_34 AC 1,407 ms
250,336 KB
testcase_35 AC 1,367 ms
250,112 KB
testcase_36 AC 267 ms
242,032 KB
testcase_37 WA -
testcase_38 AC 263 ms
242,916 KB
testcase_39 AC 270 ms
242,388 KB
testcase_40 AC 275 ms
242,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

mx = 1000001
sq = set()
for a in range(2, mx): sq.add(a**2)

l, r = LI()
r += 1
# a^2*b
dp = [0]*(r-l)

for a in sq:
    if a > r: continue
    s = (l+a-1)//a*a
    for i in range(s, r, a):
        dp[i-l] = 1

for a in range(1, mx):
    s = (l+a-1)//a*a
    for i in range(s, r, a):
        if i//a in sq: dp[i-l] = 1

print(r-l-sum(dp))
0