結果

問題 No.1274 楽しい格子点
ユーザー nagissnagiss
提出日時 2020-10-31 00:04:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 49,844 KB
最終ジャッジ日時 2023-09-29 09:12:52
合計ジャッジ時間 52,985 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 824 ms
45,340 KB
testcase_01 AC 702 ms
23,740 KB
testcase_02 WA -
testcase_03 AC 931 ms
48,964 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 940 ms
49,332 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 900 ms
48,408 KB
testcase_23 AC 894 ms
48,392 KB
testcase_24 AC 896 ms
48,448 KB
testcase_25 AC 928 ms
48,552 KB
testcase_26 AC 932 ms
48,504 KB
testcase_27 AC 902 ms
48,516 KB
testcase_28 AC 940 ms
48,440 KB
testcase_29 AC 901 ms
48,496 KB
testcase_30 AC 932 ms
48,400 KB
testcase_31 AC 936 ms
48,544 KB
testcase_32 AC 905 ms
48,356 KB
testcase_33 AC 916 ms
48,400 KB
testcase_34 AC 888 ms
48,560 KB
testcase_35 AC 888 ms
48,448 KB
testcase_36 AC 919 ms
48,552 KB
testcase_37 AC 897 ms
48,400 KB
testcase_38 AC 931 ms
48,496 KB
testcase_39 AC 913 ms
48,500 KB
testcase_40 AC 904 ms
48,392 KB
testcase_41 AC 903 ms
48,524 KB
testcase_42 AC 838 ms
45,340 KB
testcase_43 AC 852 ms
46,168 KB
testcase_44 AC 838 ms
45,220 KB
testcase_45 AC 826 ms
45,224 KB
testcase_46 AC 844 ms
45,244 KB
testcase_47 AC 831 ms
45,624 KB
testcase_48 AC 883 ms
46,608 KB
testcase_49 WA -
testcase_50 AC 882 ms
47,672 KB
testcase_51 AC 911 ms
47,260 KB
testcase_52 AC 18 ms
8,636 KB
testcase_53 AC 676 ms
23,992 KB
testcase_54 AC 682 ms
24,556 KB
testcase_55 AC 668 ms
22,192 KB
testcase_56 AC 656 ms
22,436 KB
testcase_57 AC 739 ms
25,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from collections import deque
A, B = map(int, input().split())
G = gcd(A, B) * 2
Closed = {(1, 1)}
ans = 0.25
Dx = [G,0,-G,0,A,A,-A,-A,B,B,-B,-B]
Dy = [0,G,0,-G,B,-B,B,-B,A,-A,A,-A]
q = deque([(1, 1)])
for i in range(10**5):
    if not q:
        break
    x, y = q.popleft()
    for dx, dy in zip(Dx, Dy):
        ux, uy = x+dx, y+dy
        if (ux, uy) not in Closed:
            Closed.add((ux, uy))
            q.append((ux, uy))
            if 1 <= ux < 20 and 1 <= uy < 20:
                ans += 1 / ((ux+uy)**(ux+uy))
                #print(ux, uy)
print(ans)
0