結果

問題 No.3070 Collecting Coins Speedrun 2
ユーザー 👑 SPD_9X2
提出日時 2025-03-22 22:54:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 84,144 KB
最終ジャッジ日時 2025-03-22 22:54:07
合計ジャッジ時間 3,899 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

"""

import sys

N = int(input())

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

m = 0
z = 0
p = 0

for i in c:
    if i > 0:
        p += 1
    elif i == 0:
        z += 1
    else:
        m += 1

mod = 998244353

ans = pow(2,max(0,m-1),mod) * pow(2,max(0,p-1),mod)

if m > 0 and p > 0:
    ans *= 2
if z == 1:
    if m > 0 and p > 0:
        ans *= 3
    elif m+p > 0:
        ans *= 2
    else:
        ans *= 1

print (ans % mod)
0