結果

問題 No.1514 Squared Matching
ユーザー 8nd5t8nd5t
提出日時 2022-06-08 02:42:02
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,085 bytes
コンパイル時間 914 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 841,668 KB
最終ジャッジ日時 2023-10-21 03:58:43
合計ジャッジ時間 3,176 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 171 ms
84,036 KB
testcase_01 MLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,pprint,fractions
mod = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_1(): return list(map(lambda x:int(x)-1, sys.stdin.readline().split()))
def err(x): print(x); exit()

n = inp()
res = 0
a = [set() for _ in range(n+1)]
seen = [0]*(n+1)
for i in range(2,n+1):
    if seen[i]:
        continue
    for j in range(i,n+1,i):
        seen[j] = 1
        k = j
        while k%i == 0:
            if i in a[j]:
                a[j].discard(i)
            else:
                a[j].add(i)
            k //= i
sq = [i*i for i in range(1,n+1)]

for i in range(1,n+1):
    j = 1
    for key in list(a[i]):
        j *= key
    ok = 0
    ng = n
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        if sq[mid]*j <= n:
            ok = mid
        else:
            ng = mid
    # print(i,ok)
    res += ok+1

    
print(res)
0