結果
問題 | No.2792 Security Cameras on Young Diagram |
ユーザー |
![]() |
提出日時 | 2024-06-22 00:05:17 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 840 bytes |
コンパイル時間 | 300 ms |
コンパイル使用メモリ | 82,496 KB |
実行使用メモリ | 848,084 KB |
最終ジャッジ日時 | 2024-06-22 00:05:20 |
合計ジャッジ時間 | 3,573 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
52,864 KB |
testcase_01 | AC | 33 ms
52,460 KB |
testcase_02 | AC | 38 ms
52,320 KB |
testcase_03 | AC | 68 ms
77,636 KB |
testcase_04 | AC | 91 ms
79,920 KB |
testcase_05 | AC | 64 ms
76,736 KB |
testcase_06 | AC | 107 ms
79,536 KB |
testcase_07 | AC | 78 ms
78,064 KB |
testcase_08 | AC | 78 ms
78,032 KB |
testcase_09 | AC | 59 ms
76,516 KB |
testcase_10 | AC | 71 ms
77,776 KB |
testcase_11 | AC | 84 ms
79,624 KB |
testcase_12 | MLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
ソースコード
import sys sys.setrecursionlimit(2 * (10 ** 5) + 5) N = int(input()) A = list(map(int, input().split())) MOD = 998244353 patterns = [[0] * A[i] for i in range(N)] def func(i, j): if patterns[i][j] != 0: return patterns[i][j] count = 0 if j + 1 == A[i] and (i + 1 == N or j >= A[i + 1]): # 右と下にマスがない場合 patterns[i][j] = 2 return 2 if i + 1 < N and j < A[i + 1]: # 下にマスがある場合 # i, jに右のカメラを置いたとき count += func(i + 1, j) else: count += 1 if j + 1 < A[i]: # 右にマスがある場合 # i, jに下のカメラを置いたとき count += func(i, j + 1) else: count += 1 count %= MOD patterns[i][j] = count return count print(func(0, 0))