結果

問題 No.1274 楽しい格子点
ユーザー nagissnagiss
提出日時 2020-10-31 00:11:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 607 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 49,592 KB
最終ジャッジ日時 2023-09-30 00:47:11
合計ジャッジ時間 55,065 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 707 ms
23,824 KB
testcase_02 AC 949 ms
48,580 KB
testcase_03 AC 954 ms
49,000 KB
testcase_04 AC 946 ms
49,380 KB
testcase_05 AC 974 ms
49,288 KB
testcase_06 AC 954 ms
48,860 KB
testcase_07 AC 932 ms
49,592 KB
testcase_08 AC 954 ms
49,336 KB
testcase_09 AC 969 ms
49,304 KB
testcase_10 AC 976 ms
49,436 KB
testcase_11 AC 959 ms
49,276 KB
testcase_12 AC 932 ms
49,240 KB
testcase_13 AC 986 ms
49,448 KB
testcase_14 AC 955 ms
48,472 KB
testcase_15 AC 964 ms
49,472 KB
testcase_16 AC 956 ms
48,876 KB
testcase_17 AC 952 ms
49,348 KB
testcase_18 AC 926 ms
49,440 KB
testcase_19 AC 940 ms
48,928 KB
testcase_20 AC 931 ms
48,492 KB
testcase_21 AC 953 ms
49,460 KB
testcase_22 AC 958 ms
48,408 KB
testcase_23 AC 929 ms
48,552 KB
testcase_24 AC 917 ms
48,468 KB
testcase_25 AC 957 ms
48,508 KB
testcase_26 AC 929 ms
48,616 KB
testcase_27 AC 949 ms
48,496 KB
testcase_28 AC 945 ms
48,404 KB
testcase_29 AC 970 ms
48,428 KB
testcase_30 AC 936 ms
48,516 KB
testcase_31 AC 930 ms
48,576 KB
testcase_32 AC 931 ms
48,576 KB
testcase_33 AC 943 ms
48,508 KB
testcase_34 AC 937 ms
48,504 KB
testcase_35 AC 956 ms
48,520 KB
testcase_36 AC 928 ms
48,472 KB
testcase_37 AC 921 ms
48,440 KB
testcase_38 AC 926 ms
48,560 KB
testcase_39 AC 933 ms
48,400 KB
testcase_40 AC 941 ms
48,612 KB
testcase_41 AC 912 ms
48,560 KB
testcase_42 AC 869 ms
45,388 KB
testcase_43 AC 886 ms
46,288 KB
testcase_44 AC 871 ms
45,320 KB
testcase_45 AC 848 ms
45,272 KB
testcase_46 AC 853 ms
45,360 KB
testcase_47 AC 886 ms
45,688 KB
testcase_48 AC 914 ms
46,636 KB
testcase_49 AC 853 ms
45,256 KB
testcase_50 AC 910 ms
47,668 KB
testcase_51 AC 920 ms
47,144 KB
testcase_52 AC 20 ms
8,780 KB
testcase_53 AC 689 ms
23,804 KB
testcase_54 AC 678 ms
24,472 KB
testcase_55 AC 659 ms
21,968 KB
testcase_56 AC 676 ms
22,304 KB
testcase_57 AC 718 ms
25,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from collections import deque
A, B = map(int, input().split())
G = gcd(A, B)
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:
                if not (A+B&1 == 0 and ux+uy&1):
                    ans += 1 / ((ux+uy)**(ux+uy))
print(ans)
0