結果

問題 No.1500 Super Knight
ユーザー wolgnikwolgnik
提出日時 2021-05-07 21:51:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 1,512 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 75,800 KB
最終ジャッジ日時 2023-10-13 12:53:57
合計ジャッジ時間 3,633 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
75,332 KB
testcase_01 AC 61 ms
71,084 KB
testcase_02 AC 60 ms
71,188 KB
testcase_03 AC 60 ms
71,056 KB
testcase_04 AC 60 ms
71,192 KB
testcase_05 AC 61 ms
71,080 KB
testcase_06 AC 59 ms
71,084 KB
testcase_07 AC 60 ms
71,088 KB
testcase_08 AC 61 ms
71,196 KB
testcase_09 AC 63 ms
71,064 KB
testcase_10 AC 65 ms
71,208 KB
testcase_11 AC 66 ms
70,940 KB
testcase_12 AC 67 ms
71,100 KB
testcase_13 AC 63 ms
71,100 KB
testcase_14 AC 59 ms
71,136 KB
testcase_15 AC 59 ms
71,304 KB
testcase_16 AC 61 ms
71,204 KB
testcase_17 AC 59 ms
71,084 KB
testcase_18 AC 62 ms
71,196 KB
testcase_19 AC 65 ms
71,012 KB
testcase_20 AC 73 ms
75,800 KB
testcase_21 AC 59 ms
71,060 KB
testcase_22 AC 62 ms
71,092 KB
testcase_23 AC 62 ms
70,860 KB
testcase_24 AC 60 ms
70,932 KB
testcase_25 AC 62 ms
71,168 KB
testcase_26 AC 67 ms
75,608 KB
testcase_27 AC 66 ms
71,104 KB
testcase_28 AC 72 ms
75,660 KB
testcase_29 AC 67 ms
71,052 KB
testcase_30 AC 62 ms
71,160 KB
testcase_31 AC 61 ms
71,280 KB
testcase_32 AC 61 ms
71,012 KB
testcase_33 AC 61 ms
71,148 KB
testcase_34 AC 60 ms
70,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
if N <= 5:
  size = 49
  table = [["."] * size for _ in range(size)]
  a, b = size // 2, size // 2
  table[a][b] = "#"
  #for t in table: print("".join(t))
  for _ in range(N):

    newtable = [["."] * size for _ in range(size)]
    for i in range(size):
      for j in range(size):
        if table[i][j] == "#":
          if i + 3 < size: newtable[i + 3][j] = "#"
          if i + 3 < size and j + 2 < size: newtable[i + 3][j + 2] = "#"
          if i + 2 < size and j + 3 < size: newtable[i + 2][j + 3] = "#"
          if j + 3 < size: newtable[i][j + 3] = "#"
          if 0 <= i - 3 < size and j + 2 < size: newtable[i - 3][j + 2] = "#"
          if 0 <= i - 2 < size and j + 3 < size: newtable[i - 2][j + 3] = "#"
          if 0 <=i - 3 < size: newtable[i - 3][j] = "#"
          if 0 <=i - 3 < size and 0 <= j - 2 < size: newtable[i - 3][j - 2] = "#"
          if 0 <=i - 2 < size and 0 <=j  - 3 < size: newtable[i - 2][j - 3] = "#"
          if 0 <=j - 3 < size: newtable[i][j - 3] = "#"
          if i + 3 < size and 0 <=j - 2 < size: newtable[i + 3][j - 2] = "#"
          if i + 2 < size and 0 <=j - 3 < size: newtable[i + 2][j - 3] = "#"
    #print("")
    #for t in newtable: print("".join(t))
    table = newtable
  res = 0
  for t in table: res += t.count("#")
  print(res)
else:
  res = 0
  hi = 2 * N + 1
  lo = 3 * N
  res += (lo + hi) * N
  res += (3 * N + 1) * (2 * N + 1) + (3 * N) * (2 * N)
  res %= mod
  print(res)
0