結果

問題 No.1500 Super Knight
ユーザー shotoyooshotoyoo
提出日時 2021-05-07 23:19:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 75,676 KB
最終ジャッジ日時 2023-10-13 14:40:37
合計ジャッジ時間 4,589 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,540 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 73 ms
71,524 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 78 ms
75,676 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 74 ms
71,468 KB
testcase_27 WA -
testcase_28 AC 76 ms
71,240 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")

n = int(input())
dxy = [
    [3,0],[-3,0],
    [0,3],[0,-3],
    [2,3],[3,2],
    [-2,3],[-3,2],
    [2,-3],[3,-2],
    [-2,-3],[-3,-2]
]
def sub(n):
    s = set()
    v = (0,0)
    s = [v]
    for _ in range(n):
        ns = set()
        for v in s:
            xx,yy = v
            for x,y in dxy:
                ns.add((x+xx,y+yy))
        s = ns
    return (s)
if n<7:
    ans = len(sub(n))
elif n%2==0:
    ans = ((6*n+1)**2 - 1)//2 - (n**2) + 1
else:
    ans = ((6*n+1)**2 - 1)//2 - (n**2-1)
print(ans)
0