結果

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

ソースコード

diff #

n = int(input())
pos = []
neg = []
mod = 998244353
zero = False
a = list(map(int, input().split()))
for i in a:
    if i > 0:
        pos.append(i)
    elif i < 0:
        neg.append(i)
    else:
        zero = True
if n == 1 and zero:
    print(1)
    exit()
if (len(pos) == 0 or len(neg) == 0) and zero:
    print(pow(2, n-1, mod))
    exit()
ans = pow(2, len(pos)-1, mod)*pow(2, len(neg)-1, mod)*2 % mod
if zero:
    ans *= 3
print(ans % mod)
0