結果

問題 No.3070 Collecting Coins Speedrun 2
コンテスト
ユーザー norioc
提出日時 2025-03-22 03:35:33
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 410 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 225 ms
コンパイル使用メモリ 96,368 KB
実行使用メモリ 98,188 KB
最終ジャッジ日時 2026-07-07 19:21:21
合計ジャッジ時間 3,972 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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