結果
| 問題 | 
                            No.1514 Squared Matching
                             | 
                    
| コンテスト | |
| ユーザー | 
                             8nd5t
                         | 
                    
| 提出日時 | 2022-06-08 02:42:02 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,085 bytes | 
| コンパイル時間 | 173 ms | 
| コンパイル使用メモリ | 82,092 KB | 
| 実行使用メモリ | 850,776 KB | 
| 最終ジャッジ日時 | 2024-09-21 05:02:38 | 
| 合計ジャッジ時間 | 2,976 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 MLE * 1 -- * 24 | 
ソースコード
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)
            
            
            
        
            
8nd5t