結果
| 問題 |
No.3070 Collecting Coins Speedrun 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-22 08:18:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 550 bytes |
| コンパイル時間 | 495 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 82,432 KB |
| 最終ジャッジ日時 | 2025-03-22 08:18:12 |
| 合計ジャッジ時間 | 3,541 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
from bisect import *
n=int(input())
a=list(map(int,input().split()))
mod=998244353
def f(x):
ret=1
for i in range(1,x+1):
ret*=i
ret%=mod
return ret
if n==1:
print(1)
exit()
if a[0]<0:
if a[-1]<=0:
print(pow(2,n-1,mod))
else:
if 0 in a:
place=bisect_right(a,0)
print((pow(2,place-2,mod)*pow(2,n-place-1,mod)*3*2)%mod)
else:
place=bisect_right(a,0)
print((2*pow(2,place-1,mod)*pow(2,n-place-1,mod))%mod)
else:
print(pow(2,n-1,mod))