結果

問題 No.1500 Super Knight
ユーザー shotoyooshotoyoo
提出日時 2021-05-07 23:21:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 705 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 75,552 KB
最終ジャッジ日時 2023-10-13 14:43:02
合計ジャッジ時間 4,348 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,168 KB
testcase_01 AC 72 ms
71,600 KB
testcase_02 AC 72 ms
71,572 KB
testcase_03 AC 73 ms
71,320 KB
testcase_04 AC 71 ms
71,064 KB
testcase_05 AC 71 ms
71,276 KB
testcase_06 AC 73 ms
71,144 KB
testcase_07 AC 73 ms
71,216 KB
testcase_08 AC 72 ms
71,360 KB
testcase_09 AC 70 ms
71,456 KB
testcase_10 AC 72 ms
71,412 KB
testcase_11 AC 71 ms
71,340 KB
testcase_12 AC 72 ms
71,512 KB
testcase_13 AC 71 ms
71,248 KB
testcase_14 AC 70 ms
71,360 KB
testcase_15 AC 71 ms
71,280 KB
testcase_16 AC 71 ms
71,512 KB
testcase_17 AC 72 ms
71,512 KB
testcase_18 AC 70 ms
71,248 KB
testcase_19 AC 71 ms
71,400 KB
testcase_20 AC 76 ms
75,552 KB
testcase_21 AC 71 ms
71,428 KB
testcase_22 AC 72 ms
71,272 KB
testcase_23 AC 72 ms
71,380 KB
testcase_24 AC 73 ms
71,140 KB
testcase_25 AC 71 ms
71,536 KB
testcase_26 AC 73 ms
71,340 KB
testcase_27 AC 72 ms
71,268 KB
testcase_28 AC 72 ms
71,280 KB
testcase_29 AC 73 ms
71,216 KB
testcase_30 AC 72 ms
71,244 KB
testcase_31 AC 73 ms
71,380 KB
testcase_32 AC 73 ms
71,356 KB
testcase_33 AC 72 ms
71,284 KB
testcase_34 AC 71 ms
71,316 KB
権限があれば一括ダウンロードができます

ソースコード

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)
M = 10**9+7
print(ans%M)
0