結果

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

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)rg
# (itertools.prrange(n)):
"""
n = 5
s = set()
for i in range(1<<n):
    a,b = [],[]
    for j in range(n):
        if(i >> j) & 1 == 0:
            a.append(j)
        else:
            b.append(j)
    b.reverse()
    a += b
    s.add(tuple(a))
print(len(s))
exit()
"""

n = int(input())
a = list(map(int,input().split()))
#alist = []
#s = input()
#n,m = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
def f(r):
    if r <= 1:
        return 1
    else:
        return pow(2,r-1,mod)
x,y,z = 0,0,0
for i in a:
    if i < 0:
        x += 1
    if i == 0:
        y += 1
    if i > 0:
        z += 1

mod = 998244353
ans = f(x) * f(z)
if x > 0 and z > 0:
    ans *= 2
if y == 1:
    ans *= (1 + min(1,x) + min(1,z))
print(ans % mod)
0