結果

問題 No.1653 Squarefree
ユーザー mkawa2mkawa2
提出日時 2023-02-19 15:32:53
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,254 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 85,892 KB
最終ジャッジ日時 2023-09-27 21:16:40
合計ジャッジ時間 58,539 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 75 ms
76,080 KB
testcase_02 AC 75 ms
75,520 KB
testcase_03 AC 121 ms
77,672 KB
testcase_04 AC 73 ms
75,996 KB
testcase_05 AC 73 ms
75,960 KB
testcase_06 AC 74 ms
75,988 KB
testcase_07 AC 72 ms
75,956 KB
testcase_08 AC 74 ms
75,972 KB
testcase_09 AC 77 ms
76,080 KB
testcase_10 AC 72 ms
76,036 KB
testcase_11 AC 1,836 ms
85,516 KB
testcase_12 AC 1,806 ms
85,560 KB
testcase_13 AC 1,986 ms
85,864 KB
testcase_14 AC 1,952 ms
85,500 KB
testcase_15 TLE -
testcase_16 AC 1,990 ms
85,552 KB
testcase_17 AC 1,979 ms
85,812 KB
testcase_18 AC 1,989 ms
85,892 KB
testcase_19 AC 1,985 ms
85,756 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,970 ms
85,412 KB
testcase_24 AC 1,964 ms
85,320 KB
testcase_25 AC 1,981 ms
85,680 KB
testcase_26 TLE -
testcase_27 AC 1,957 ms
85,620 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 1,969 ms
85,480 KB
testcase_32 AC 1,981 ms
85,476 KB
testcase_33 AC 1,964 ms
85,432 KB
testcase_34 TLE -
testcase_35 TLE -
testcase_36 AC 107 ms
76,404 KB
testcase_37 AC 110 ms
76,592 KB
testcase_38 AC 110 ms
76,564 KB
testcase_39 AC 107 ms
76,564 KB
testcase_40 AC 105 ms
76,568 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

def floor_sqrt(x):
    a = round(x**0.5-0.49)
    while a**2 > x: a -= 1
    return a

def issquare(a):
    if a==1:return False
    r=floor_sqrt(a)
    return r**2==a

mx = 1000001

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

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

for a in range(1, mx):
    if a >= r: break
    s = (l+a-1)//a*a
    for i in range(s, r, a):
        if issquare(i//a): dp[i-l] = 1
# pDB(dp)

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