提出 #61804700


ソースコード 拡げる

R = int(input())*2

def is_ok(y,k):
    x = 2*k-1
    return x*x + y*y <= R*R

ok = 0
ng = R+1
while ng-ok > 1:
    mid = (ok+ng)//2
    if is_ok(1,mid):
        ok = mid
    else:
        ng = mid

ans = 2*ok - 1

for y in range(3,R+1,2):
    ok = 0
    ng = R+1
    while ng-ok > 1:
        mid = (ok+ng)//2
        if is_ok(y,mid):
            ok = mid
        else:
            ng = mid
    x = 2*ok - 1
    ans += 2*x
print(ans)

提出情報

提出日時
問題 D - Squares in Circle
ユーザ prd_xxx
言語 Python (PyPy 3.10-v7.3.12)
得点 400
コード長 461 Byte
結果 AC
実行時間 173 ms
メモリ 81572 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 25
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 57 ms 76204 KiB
00_sample_01.txt AC 56 ms 76440 KiB
00_sample_02.txt AC 56 ms 76580 KiB
01_random_00.txt AC 90 ms 80960 KiB
01_random_01.txt AC 160 ms 81172 KiB
01_random_02.txt AC 108 ms 81040 KiB
01_random_03.txt AC 166 ms 81572 KiB
01_random_04.txt AC 131 ms 80968 KiB
01_random_05.txt AC 133 ms 80992 KiB
01_random_06.txt AC 162 ms 81560 KiB
01_random_07.txt AC 82 ms 81496 KiB
01_random_08.txt AC 138 ms 81028 KiB
01_random_09.txt AC 70 ms 81460 KiB
01_random_10.txt AC 169 ms 80976 KiB
01_random_11.txt AC 171 ms 81044 KiB
01_random_12.txt AC 171 ms 81016 KiB
01_random_13.txt AC 170 ms 81136 KiB
01_random_14.txt AC 171 ms 81348 KiB
01_random_15.txt AC 172 ms 81364 KiB
01_random_16.txt AC 173 ms 81076 KiB
01_random_17.txt AC 168 ms 80992 KiB
01_random_18.txt AC 168 ms 81468 KiB
01_random_19.txt AC 169 ms 81252 KiB
01_random_20.txt AC 56 ms 76484 KiB
01_random_21.txt AC 171 ms 81108 KiB