結果
問題 | No.1653 Squarefree |
ユーザー | mkawa2 |
提出日時 | 2023-02-19 15:32:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,739 ms / 2,000 ms |
コード長 | 1,254 bytes |
コンパイル時間 | 285 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 84,524 KB |
最終ジャッジ日時 | 2024-07-20 15:48:43 |
合計ジャッジ時間 | 44,919 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,525 ms
84,272 KB |
testcase_01 | AC | 44 ms
58,496 KB |
testcase_02 | AC | 44 ms
58,112 KB |
testcase_03 | AC | 98 ms
76,504 KB |
testcase_04 | AC | 46 ms
58,368 KB |
testcase_05 | AC | 45 ms
58,496 KB |
testcase_06 | AC | 45 ms
58,240 KB |
testcase_07 | AC | 45 ms
58,240 KB |
testcase_08 | AC | 45 ms
58,624 KB |
testcase_09 | AC | 44 ms
58,112 KB |
testcase_10 | AC | 46 ms
58,368 KB |
testcase_11 | AC | 1,397 ms
84,212 KB |
testcase_12 | AC | 1,388 ms
84,096 KB |
testcase_13 | AC | 1,506 ms
84,256 KB |
testcase_14 | AC | 1,506 ms
84,204 KB |
testcase_15 | AC | 1,523 ms
84,352 KB |
testcase_16 | AC | 1,515 ms
84,480 KB |
testcase_17 | AC | 1,507 ms
84,224 KB |
testcase_18 | AC | 1,514 ms
84,116 KB |
testcase_19 | AC | 1,508 ms
84,352 KB |
testcase_20 | AC | 1,697 ms
84,352 KB |
testcase_21 | AC | 1,730 ms
84,224 KB |
testcase_22 | AC | 1,716 ms
84,428 KB |
testcase_23 | AC | 1,482 ms
84,044 KB |
testcase_24 | AC | 1,494 ms
84,268 KB |
testcase_25 | AC | 1,521 ms
84,176 KB |
testcase_26 | AC | 1,644 ms
84,224 KB |
testcase_27 | AC | 1,532 ms
84,352 KB |
testcase_28 | AC | 1,676 ms
84,336 KB |
testcase_29 | AC | 1,725 ms
84,480 KB |
testcase_30 | AC | 1,710 ms
84,224 KB |
testcase_31 | AC | 1,497 ms
84,480 KB |
testcase_32 | AC | 1,515 ms
84,524 KB |
testcase_33 | AC | 1,499 ms
84,280 KB |
testcase_34 | AC | 1,739 ms
84,180 KB |
testcase_35 | AC | 1,714 ms
83,968 KB |
testcase_36 | AC | 80 ms
60,288 KB |
testcase_37 | AC | 81 ms
60,672 KB |
testcase_38 | AC | 81 ms
60,800 KB |
testcase_39 | AC | 81 ms
60,288 KB |
testcase_40 | AC | 81 ms
60,444 KB |
ソースコード
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))