結果

問題 No.1514 Squared Matching
ユーザー convexineqconvexineq
提出日時 2021-05-21 21:41:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,460 ms / 4,000 ms
コード長 369 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 81,984 KB
実行使用メモリ 467,156 KB
最終ジャッジ日時 2024-04-18 14:58:49
合計ジャッジ時間 57,986 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,864 KB
testcase_01 AC 3,386 ms
466,812 KB
testcase_02 AC 34 ms
53,156 KB
testcase_03 AC 33 ms
53,356 KB
testcase_04 AC 33 ms
52,940 KB
testcase_05 AC 50 ms
66,476 KB
testcase_06 AC 109 ms
81,860 KB
testcase_07 AC 668 ms
150,368 KB
testcase_08 AC 3,230 ms
452,596 KB
testcase_09 AC 2,823 ms
405,572 KB
testcase_10 AC 2,990 ms
432,244 KB
testcase_11 AC 3,161 ms
447,536 KB
testcase_12 AC 3,214 ms
457,864 KB
testcase_13 AC 3,460 ms
462,544 KB
testcase_14 AC 3,319 ms
464,528 KB
testcase_15 AC 3,333 ms
466,192 KB
testcase_16 AC 3,334 ms
466,752 KB
testcase_17 AC 3,382 ms
466,840 KB
testcase_18 AC 3,329 ms
466,988 KB
testcase_19 AC 3,323 ms
467,156 KB
testcase_20 AC 3,331 ms
466,856 KB
testcase_21 AC 3,336 ms
466,728 KB
testcase_22 AC 697 ms
154,232 KB
testcase_23 AC 1,384 ms
232,608 KB
testcase_24 AC 2,057 ms
310,552 KB
testcase_25 AC 2,899 ms
388,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def isqrt(n):
    assert n >= 0
    if n < 2: return n
    x = int(n**0.5)*2
    while x*x > n:
        x = (x+n//x)//2
    return x

n = int(input())
ans = 0
r = [1]*(n+1)
for i in range(1,n+1):
    if r[i] == 0: continue
    c = 0
    for j in range(1,n+1):
        v = i*j*j
        if v > n: break
        c += 1
        r[v] = 0
    ans += isqrt(n//i)*c
print(ans)
0