結果

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

ソースコード

diff #

MOD = 998244353
N = int(input())
A = list(map(int, input().split()))

neg = pos = 0
for a in A:
    if a < 0:
        neg += 1
    elif a > 0:
        pos += 1

res = 1
if neg > 1:
    res *= pow(2, neg-1, MOD)
if pos > 1:
    res *= pow(2, pos-1, MOD)
if neg > 0 and pos > 0:
    res *= 2
if 0 in A:
    if neg > 0 and pos > 0:
        res *= 3
    elif neg > 0 or pos > 0:
        res *= 2

print(res % MOD)
0