結果

問題 No.3070 Collecting Coins Speedrun 2
ユーザー Meso Meso
提出日時 2025-07-17 09:48:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 20,996 KB
最終ジャッジ日時 2025-07-17 09:48:54
合計ジャッジ時間 4,570 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353

n = int(input())
c = list(map(int, input().split()))

ans = 0
if 0 <= c[0] and 0 <= c[-1]:
    ans = pow(2, n-1, mod)
elif c[0] < 0 and c[-1] <= 0:
    ans = pow(2, n-1, mod)
elif 0 in c:
    ans = (pow(2, n-2, mod) * 3 % mod)
else:
    ans = pow(2, n-1, mod)

print(ans)
0