結果

問題 No.3070 Collecting Coins Speedrun 2
ユーザー titia
提出日時 2025-03-21 22:37:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 21,016 KB
最終ジャッジ日時 2025-03-21 22:37:30
合計ジャッジ時間 3,303 ms
ジャッジサーバーID
(参考情報)
judge3 / judge7
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
C=list(map(int,input().split()))

mod=998244353

MAX=max(C)
MIN=min(C)

if MIN>=0:
    ANS=1
    for c in C:
        if c!=MAX:
            ANS=ANS*2%mod

    print(ANS)

elif MAX<=0:
    ANS=1
    for c in C:
        if c!=MIN:
            ANS=ANS*2%mod

    print(ANS)

else:
    ANS=2
    for c in C:
        if c==0:
            ANS=ANS*3%mod
        elif c!=MIN and c!=MAX:
            ANS=ANS*2%mod

    print(ANS)
0