結果
| 問題 |
No.1514 Squared Matching
|
| コンテスト | |
| ユーザー |
8nd5t
|
| 提出日時 | 2022-06-08 02:41:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,254 bytes |
| コンパイル時間 | 398 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 853,888 KB |
| 最終ジャッジ日時 | 2024-09-21 05:02:34 |
| 合計ジャッジ時間 | 4,074 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
sys.setrecursionlimit(10**8)
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
# print(i,j)
# if i == n:
# res += 1
# continue
# if i == 254:
# pass
# print(1)
# pass
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